Click to See Complete Forum and Search --> : Simple "I'm Pulling My Hair Out" Question


trevorsg
01-12-2008, 10:04 PM
I think I just need another pair of eyes to look at this one.

I have a Javascript function called check() that is called when a form is submitted:


<form action="page.php" method="post" onsubmit="return check();">


I have dumbed down the JS function, just for debugging, and I still can't get it to run:

<script>
function check()
{
window.alert("It works!");
return true;
}
</script>


When I submit the form, it submits like normal and does not run the check() function. My other Javascript on the page works fine.

Any ideas? Thanks!

NogDog
01-12-2008, 11:30 PM
Seems to work OK for me. You might want to run the page through the HTML validator (http://validator/w3c.org/) and make sure there are no HTML syntax errors throwing things off.

jazz_snob
01-13-2008, 12:32 AM
I don't know but depending on browser do you have to have the <script> tag like this?:
<script type="text/javascript">
//code
</script>