Friday, March 29, 2013

Onclick select all Text in Textbox using Javascript in Asp .NET

==>>  Create a website in add new page  and paste the Code:--


1.  ASPX PAGE CODE:-

 <html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Onclick select all Text in Textbox using Javascript in Asp .NET</title>
<script type="text/javascript">
function SelectAll(id) {
document.getElementById(id).focus();
document.getElementById(id).select();
}
</script>
</head>
<body>
<div>
Enter Strengths :<br/>
<input type="text" id="TxtStrengths" onclick="SelectAll('TxtStrengths');" style="width:200px" value = "I am very confident and a good player of cricket" /><br />
Hobbies :<br/>
<textarea rows="5" cols="23" id="TxtHobbies" onclick="SelectAll('TxtHobbies');" style="width:200px" I like playing cricket. </textarea>
</div>
</body>
</html>


Hope this will help you....

No comments:

Post a Comment