|
-
Jun 21st, 2002, 11:19 AM
#1
Thread Starter
Lively Member
Re: question here by a dummy
How do i make a check on the first digit and second digit of textbox - not the actuall whole value of the textbox but only the first and second digit, regardless of how many digits there are in the actuall value of the textbox because i want to perform an action if the first character that is entered in the textbox is equal to 0. thanks
-
Jun 21st, 2002, 01:04 PM
#2
Fanatic Member
Code:
<script language="JavaScript">
function checkValue(textboxValue) {
textboxValue = textboxValue.value;
if (textboxValue[0] == 0) {
// write code here
}
}
</script>
Code:
<form name="formName" method="post" action="#">
<input type="text" name="textBox" onBlur="checkValue(this);">
</form>
-
Jun 26th, 2002, 11:51 AM
#3
Hyperactive Member
<html><head>
<script language="JavaScript">
function checkValue(textboxValue) {
t = textboxValue.textBox.value;
if (t.charAt(0) == 0 || t.charAt(1) == 0 )
{
alert("yes it's a zero");
}
}
</script>
</script></head>
<body>
<form name="formName" method="post" action="#">
<input type="text" name="textBox" onBlur="checkValue(formName);">
<input type="text" name="dd" >
<input type = "button">
</form>
</body>
</html>
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
|