473,326 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

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=username04761316 >
<INPUT TYPE=hidden NAME="Password" value=password05497967 >
<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
Jul 23 '05 #1
2 3169


Richard Jonas wrote:
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=username04761316 >
<INPUT TYPE=hidden NAME="Password" value=password05497967 >
<INPUT TYPE=hidden value="Sign in">
</FORM>
</body>
<script>
window.onload = document.forms[0].submit;


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
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Martin Honnen <ma*******@yahoo.de> wrote in message news:<41***********************@newsread2.arcor-online.net>...
Richard Jonas wrote:
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=username04761316 >
<INPUT TYPE=hidden NAME="Password" value=password05497967 >
<INPUT TYPE=hidden value="Sign in">
</FORM>
</body>
<script>
window.onload = document.forms[0].submit;


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.


Thanks Martin. This seems to fix the problem.

Regards
Richard
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jadiyo | last post by:
Hi, I've read many questions about how to automatically open a new window from a page using the JavaScript onLoad command. Unfortunately, due to the web application framework being used...
3
by: Liming | last post by:
Hi, Here is my situation. I have a textarea on the page. When the page loads, I need it to have some default text (which will be generated dynamically) so I did something like this ...
3
by: Frances | last post by:
I have three functions I need triggered when page loads, so have <body onload="function1();function2();function3()"> but I want to take all these function calls out of body tag and call them...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
7
by: Jaggu | last post by:
Hi , I need to close main window, once the child window succesfully opens else main window to remain. In my case when I close the main window immediately after the "window.open()" as mentioned...
9
by: tshad | last post by:
This was posted before but the message got messed up (all NLs were stripped out for some reason). I have 2 labels that hold the name of different images on my .aspx page. <asp:Label ID="Logo"...
4
by: Jason | last post by:
Hi, Here's the scenario: I have a web application that has window A and window B. A user has both window A and B open - window A is in the foreground and window B is behind it. If the...
20
by: Mark Anderson | last post by:
Hi, I have this in an external JS library: ///////////////////////// function addMyEvent(){ var obj; if(document.attachEvent) { obj = document.getElementsByTagName('img'); for...
5
by: lilOlMe | last post by:
Hi there! I'm developing some crazy Tab Control in .NET that uses JavaScript. A particular JavaScript method needs to be called during the window.onload event in order to initialize my Tab...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.