Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HighlightingText in a TextBox in VBScript

Status
Not open for further replies.

purrhapz

Programmer
Aug 10, 2000
1
US
Hello,<br><br>Can anyone tell me how to select(highlight) text in a textbox? In my asp, when the submit button is clicked I verify that a value in a textbox is between 100 and 999,999. If the number is less than 1000 I use a MsgBox to ask the user if this is correct info. If they click &quot;No&quot; button then I set focus to the box. I want to be able to highlight what is there. Does anyone have any code they are willing to share to accomplish this? <br><br>Thanks in advance!<br>
 
Try this...

Code:
<html>
<head>
</head>
<body>
<form id=frmForm name=frmForm>
 Text box:<input type=text id=txtbox name=txtbox value=&quot;This is some text&quot; width=50>
</form>
</body>

<!--use either/or not both-->
<!--javascript example-->
<script language=&quot;javascript&quot;>
 document.frmForm.txtbox.focus();
 document.frmForm.txtbox.select();
</script>
</html>

<!--vbscript example-->
<script language=&quot;vbscript&quot;>
 document.frmForm.txtbox.focus()
 document.frmForm.txtbox.select()
</script>

Hope this helps,
Rob [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top