SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Eazy - Focus

  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    ny
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Eazy - Focus

    Hi ,
    I am trying to verify the input of text boxes...My code seems working...but onchange function shouldnt let user to go the other text boxes unless the number is an integer and less than 13...

    Code:
    	<input name="hr7" value="" type="text" size="2" maxlength="2" style="width:20px;font-size:9pt;text-align:left;font-family:Arial, Helvetica, sans-serif" onchange="javascript:return ckN (this.value);">
    
    <script language="javascript">
    function ckN(a){
    	if (isNaN(a)) { alert('Integer Numbers only');  } 
    	else if ( a > 12) { alert('Please enter a number less than 13');  } 
    	
    
    	}
    </script>

  2. #2
    SitePoint Zealot
    Join Date
    Sep 2007
    Posts
    136
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code HTML4Strict:
    <input name="hr7" value="" type="text" size="2" maxlength="2" style="width:20px;font-size:9pt;text-align:left;font-family:Arial, Helvetica, sans-serif" onchange="return ckN (this.value);">
     
    <script language="javascript">
    function ckN(a){
    	if (isNaN(a)) { alert('Integer Numbers only');  return false;} 
    	else if ( a > 12) { alert('Please enter a number less than 13');  return false;} 
    	return true;
     
    	}
    </script>

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2004
    Location
    ny
    Posts
    560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you gimbles,


Bookmarks

Posting Permissions

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