window.onload not being called

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Richard Jonas

    window.onload not being called

    I'm trying to submit a form from a window.onload event as follows:

    <body>
    <form method="POST" action="http://www.website.co. uk" name=login>
    <INPUT TYPE=hidden NAME="Username" value=username0 4761316 >
    <INPUT TYPE=hidden NAME="Password" value=password0 5497967 >
    <INPUT TYPE=hidden value="Sign in">
    </FORM>
    </body>
    <script>
    window.onload = document.forms[0].submit;
    </script>

    This page looks up a username and password and submits a form to log
    on to another application on a different server. This works on my PC
    and on most other PCs I've used to test this on, but it's not working
    on one of our user's PCs. It remains on this page, and it appears as
    if no attempt is made to execute the script.

    We're both using Internet Explorer 6. Are there any browser settings
    (or anything else she might have installed, such as popup blockers)
    that might stop this code being run? I've checked the proxy server
    isn't stripping out the JavaScript.

    Thanks,

    Richard
  • Martin Honnen

    #2
    Re: window.onload not being called



    Richard Jonas wrote:
    [color=blue]
    > I'm trying to submit a form from a window.onload event as follows:
    >
    > <body>
    > <form method="POST" action="http://www.website.co. uk" name=login>
    > <INPUT TYPE=hidden NAME="Username" value=username0 4761316 >
    > <INPUT TYPE=hidden NAME="Password" value=password0 5497967 >
    > <INPUT TYPE=hidden value="Sign in">
    > </FORM>
    > </body>
    > <script>
    > window.onload = document.forms[0].submit;[/color]

    That should be
    window.onload = function (evt) {
    document.forms[0].submit();
    }
    though browser might warn the user about script trying to submit the
    form data without consent/action from the user.
    --

    Martin Honnen

    Comment

    • Richard Jonas

      #3
      Re: window.onload not being called

      Martin Honnen <mahotrash@yaho o.de> wrote in message news:<41a6084b$ 0$29850$9b4e6d9 3@newsread2.arc or-online.net>...[color=blue]
      > Richard Jonas wrote:
      >[color=green]
      > > I'm trying to submit a form from a window.onload event as follows:
      > >
      > > <body>
      > > <form method="POST" action="http://www.website.co. uk" name=login>
      > > <INPUT TYPE=hidden NAME="Username" value=username0 4761316 >
      > > <INPUT TYPE=hidden NAME="Password" value=password0 5497967 >
      > > <INPUT TYPE=hidden value="Sign in">
      > > </FORM>
      > > </body>
      > > <script>
      > > window.onload = document.forms[0].submit;[/color]
      >
      > That should be
      > window.onload = function (evt) {
      > document.forms[0].submit();
      > }
      > though browser might warn the user about script trying to submit the
      > form data without consent/action from the user.[/color]

      Thanks Martin. This seems to fix the problem.

      Regards
      Richard

      Comment

      Working...