Results 1 to 6 of 6

Thread: this may be a dumn question but...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89
    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

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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>

  3. #3
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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.
    Mark
    -------------------

  4. #4

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89
    Hey guys thanks for the help. IM going to try it out it now.

    Regards

    Scott

  5. #5
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    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

  6. #6
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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
    Mark
    -------------------

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width