Passing Form Objects to Functions??

Information and discussion on Javascript.

Moderators: rcrisler1, saltybeagle

Postby saltybeagle » Tue May 31, 2005 3:30 pm

You should be able to just reference the values f and s, and not have to worry about the document. etc... like so:

Code: Select all
<script type="text/javascript">
function nextStep(f, s)
{
var value = s.options[s.selectedIndex].value;
if(value){
alert("The value selected was "+ value);
}
else{
alert("Reset the form");
f.reset();
}
}
</script>

I tested in mozilla and it works... I think* it should work for you. Unless IE doesn't like it for some reason? hmmm
Brett Bieber
Image
saltybeagle
 
Posts: 376
Joined: Fri Jan 16, 2004 3:10 pm
Location: 321 Admin


Return to Javascript

Who is online

Users browsing this forum: No registered users and 1 guest

cron