By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,940 Members | 1,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,940 IT Pros & Developers. It's quick & easy.

onload to submit

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
"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

P: n/a
<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.