|
-
Jun 26th, 2000, 09:20 AM
#1
Thread Starter
Lively Member
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
-
Jun 26th, 2000, 11:16 AM
#2
Guru
Code:
<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>
-
Jun 26th, 2000, 02:53 PM
#3
Frenzied Member
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.
-
Jun 26th, 2000, 09:21 PM
#4
Thread Starter
Lively Member
Hey guys thanks for the help. IM going to try it out it now.
Regards
Scott
-
Jun 26th, 2000, 09:42 PM
#5
Guru
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
-
Jun 26th, 2000, 10:04 PM
#6
Frenzied Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|