Forum Moderators: open
Right now I'm just trying to get my script to run, using an alert box to test.
This is in my head:
<script type="text/javascript">
window.onload=function(){
window.onsubmit=function(){
alert("hi");
return false;}}
</script>
And this is in my body:
<form action="/" method="post">
<div><input type="submit" /></div>
</form>
Additionally let me add, you should be referencing your objects by ID, not by name, it's just an easier method of accessing document objects and a better habit to form.
<script type="text/javascript">
if (document.getElementById) {
window.onload=function() {
document.getElementById('my-form').onsubmit=function(){
alert("hi");
return false;
}
}
}
</script>
<form action="/" id="my-form" method="post">
<div><input type="submit" id="submitButton" value="Submit"></div>
</form>
<snicker> Fotiman is too quick once again. :-)