simple onload script

J

JRough

CAn you tell me if this is right? I just need the javascript to
submit the form. That is all. A database substitutes the #q for a
serialized list of addresses. JAvascript should submit the form and
php should be able to $_POST the q value. I just want to double check
my javascript.
thanks,

<html>
<body>
<script type=”text/javascript” onload=”document.pgform.submit()”>
<form name=”pgform” action=”http://99.XX,XX,64/pooglemap2.php”
method=”post”>
<textarea name=q>
#q
</textarea>
<input type=submit value=”show map”>
</form>
</body>
</html>
 
V

VK

....
<body>
<script type=”text/javascript” onload=”document.pgform.submit()”>
<form name=”pgform” action=”http://99.XX,XX,64/pooglemap2.php”
method=”post”>
....

onload handler is of body, not of script:

....
<form name=”pgform” action=”http://99.XX,XX,64/pooglemap2.php”
method=”post”>
....

<script> element is is not needed at all here: unless some very
particular situations with a mixture of VBScript and JScript
expressions on a single IE-targeted page. If it's the case then tell
us.
 
V

VK

...
<body onload="document.pgform.submit()">

To be on the safe side I would use the conventional sysntax instead of
shortcuts:
<body onload="document.forms['pgform'].submit()">

And make sure that you don't have any elements in your form named
"submit" - or all hell doors will get loose.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top