1

I use below source code in my script.

I worked fine with Crome Browser.

but didn't work with Internet Explorer.

How can I do?

somebody help me please.

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <script language="JavaScript">
        <!--
        function login() {
            document.form1.action="http://website.com/login/login.asp";
            document.form1.submit();
        }
        //-->
    </script>
</head>
<body onload="login()">
<form method=post name="form1" id="form1">
    <input type="hidden" name="ID_Text" value="abcd">
    <input type="hidden" name="PW_Text" value="abcd">
</form>
</body>
</html>
Andy
  • 49,085
  • 60
  • 166
  • 233
user3559402
  • 21
  • 2
  • 4
  • The attribute `language` is deprecated for the tag `script`, maybe IE is trying to validate your code (not sure about this...). You can try to change it to be `type="text/javascript"` – Totò Apr 22 '14 at 08:01
  • Can't test now, no IE at hand, but try in addition to @Totò's comment deleting ``. It is [obsolete practice](http://stackoverflow.com/questions/808816/are-html-comments-inside-script-tags-a-best-practice), it is actively harmful, and it's the only thing that I can see that might be a problem. Also, "didn't work" is rather vague. What happens? Any errors? Did the form submit but the login fail? What happens if you insert an `alert("before submit")` or three? – Amadan Apr 22 '14 at 08:02
  • 1
    @Totò That is also pretty much useless. [sauce](http://www.w3.org/html/wg/drafts/html/master/scripting-1.html#the-script-element) – PeeHaa Apr 22 '14 at 08:03
  • 1
    @PeeHaa true, it's the default value... – Totò Apr 22 '14 at 08:04
  • @Amadan Thanks for answer. Do the form submit, It has login fail. – user3559402 Apr 22 '14 at 10:08
  • @Totò Thanks for answer. I changed to – user3559402 Apr 22 '14 at 10:11
  • when I try login with IE. I saw error message "D:\path\path\.../include/left_mymenu.asp." – user3559402 Apr 22 '14 at 10:20
  • Shouldn't it be `` (assigning function, not calling it)? – The Witness Jul 15 '19 at 12:23

1 Answers1

0

I am pulling the answer out of your question for future visitors.

<!DOCTYPE html>
    <head>
    </head>
    <body>
        <script type="text/javascript">
            BoardURL="http://WEBSITE.COM";
            UserName="abcd";
            PassWord="abcd";
            document.write('<form name="autoLogin" action="'+BoardURL+'/login/login.asp" method="post"><input type="hidden" name="ID_TEXT" value="'+UserName+'"><input type="hidden" name="PW_TEXT" value="'+PassWord+'">');
            document.forms[0].submit();
        </script>
    </body>
</html>
Andy
  • 49,085
  • 60
  • 166
  • 233