Click to See Complete Forum and Search --> : this may be a dumn question but...
scottr
Jun 26th, 2000, 09:20 AM
hi how do i call a verifcation script in javascript before i submit my asp page. i know its a silly question but im very confused by it.
Regards,
Scott
Clunietp
Jun 26th, 2000, 11:16 AM
<HTML>
<BODY>
<FORM name=frmMain method=POST>
Enter Your Name
<BR>
<INPUT NAME="txtName">
<INPUT TYPE="BUTTON" VALUE="GO!" ONCLICK="verifyForm();">
</FORM>
</BODY>
</HTML>
<SCRIPT LANGUAGE="JAVASCRIPT">
function verifyForm()
{
// make sure they put something in the text box
if (document.frmMain.txtName.value == "")
// give message
window.alert("You didn't enter your name!")
else
// submit form
document.frmMain.submit();
}
</SCRIPT>
Mark Sreeves
Jun 26th, 2000, 02:53 PM
Tom (Clunietp) is right as usual but I would put the Javascript between <head> </head> tags at the top to ensure the code is visable to the whole page.
scottr
Jun 26th, 2000, 09:21 PM
Hey guys thanks for the help. IM going to try it out it now.
Regards
Scott
Clunietp
Jun 26th, 2000, 09:42 PM
Hi Mark
What is the difference if I put the code between the HEAD tags instead of before or after the HTML tags? I usually like to separate my HTML from my Javascript functions and it works in IE and Netscape
I'm not formally trained in Web Dev so if you could give me an explanation, that would be great
many thanks!
Tom
Mark Sreeves
Jun 26th, 2000, 10:04 PM
Tom
I'm self taught as well.
I remember reading it somewhere probably on http://www.irt.org because that used to be my main source of reference.
I just had I quick search around on it but I can't find it now.
OK so I found just it:
http://developer.irt.org/script/421.htm
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.