470,849 Members | 1,100 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,849 developers. It's quick & easy.

onload to submit

i wish the html to submit the form once it is loaded.

what should be the code here (alert("how 's the code here"))?

Grateful if you could help me. Thanks a lot.

Tony
*************************************************
<html>
<head>
<script language="JavaScript" type="text/javascript">
function window_onload()
{
alert("how 's the code here")
}
</script>
</head>
<body bgcolor=green onload=window_onload()>
<FORM NAME="Form1"ACTION="page2.asp" METHOD="POST" target=mainFrame>
<SELECT NAME="YEARLIST">
<OPTION>01</OPTION>
<OPTION>02</OPTION>
</SELECT>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Reset">
</body>
</html>
Aug 12 '05 #1
2 5876
"tony wong" <x3*@netvigator.com> wrote in message
news:42********@127.0.0.1...
i wish the html to submit the form once it is loaded.

what should be the code here (alert("how 's the code here"))?

Grateful if you could help me. Thanks a lot.

Tony
*************************************************
<html>
<head>
<script language="JavaScript" type="text/javascript">
function window_onload()
{
alert("how 's the code here")
}
</script>
</head>
<body bgcolor=green onload=window_onload()>
<FORM NAME="Form1"ACTION="page2.asp" METHOD="POST" target=mainFrame>
<SELECT NAME="YEARLIST">
<OPTION>01</OPTION>
<OPTION>02</OPTION>
</SELECT>
<INPUT TYPE="SUBMIT" VALUE="Submit">
<INPUT TYPE="RESET" VALUE="Reset">
</body>
</html>


If you want the form to be submitted once the page loads
why bother to include any buttons; also,
why submit the form before an option can be selected?

But if what you say you want is what you really want
then just change your <body> tag to
<body onload="document.Form1.submit()">
and remove the <script> section.
P.S. You clock may be off.
Aug 12 '05 #2
<formname>.submit()
ie form1.submit()

or document.form1.submit

if you have a parameter on the function forma cal also be passed

Aug 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Richard Bell | last post: by
7 posts views Thread by Tery Griffin | last post: by
2 posts views Thread by Richard Jonas | last post: by
2 posts views Thread by JS | last post: by
reply views Thread by Fabio R. | last post: by
5 posts views Thread by Andy Fish | last post: by
8 posts views Thread by niebo077 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.