HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
checking a value within a form field
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
cbruce



Joined: 01 Nov 2004
Posts: 1

PostPosted: Mon Nov 01, 2004 8:52 am     checking a value within a form field Reply with quote

How can I test for a specific value in the 9th character of an input field? ex: I have a 16 character field and I need to know if the 9th character = "B".
nagasree



Joined: 21 Sep 2004
Posts: 81
Location: Hyderabad, India

PostPosted: Tue Nov 02, 2004 1:52 am     Reply with quote

Try this
Code:

<script language="javascript">
   function CheckChar(frm)
   {
      var strVal= frm.txtTest.value;
      alert("Char at nineth postion : " + strVal.substring(8,9))
      alert("two Chars from twelfth postion : " + strVal.substring(11,13))
   }
</script>
<BODY>
<FORM name=frmSample>
<INPUT TYPE="text" NAME="txtTest" value="This is an example"><BR>
<INPUT TYPE="button" name="bntCheck" value="Check" onclick="javascript:CheckChar(this.form)">
</FORM>
</BODY>


-Nagasree
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Webmaster Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial