newbie wishes to select text

Posted in dotnet, vb, vb.net | No Comments »

I have a textbox that I am going to have the user place a search phrase in. when the page load there will be text inside the box already "search phrase" how the heck do I get this text to come up as already selected on load

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

<script type="text/javascript">

function selectAll() {
document.form1.textBox1.focus();
document.form1.textBox1.select();
}

</script>
</head>

<body>
<form id="form1" runat="server">

<div>

<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label runat="server" ID="rgiHeaderLabel" BackColor="#99FFCC"
Font-Bold="True" Font-Names="Arial Rounded MT Bold" Font-Size="X-Large"
ForeColor="#6666FF" >RGI Agency/Resource Search</asp:Label>

<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1" runat="server" Width="228px">search phrase</asp:TextBox>

<br />
<br />
<br />
<br />
<br />

<asp:datagrid runat="server" id="contactInfoDataGrid" />

</div>
</form>

<body onload="selectAll();">
</body>

</html>

Similar:

  1. I want to get the latitude and longitude from the Gmap control into textboxes Hi All. I tried with the following but it doesn’t work var txtlat=document.getElementById('TextBox1').value=GMap1.getCenter().lat(); var txtlong=document.getElementById('TextBox2').value=GMap1.getCenter().lng(); It gives a JavaScript error as “Object doesn’t support this...
  2. unable to put the html text into message of theMailItem.HTMLBody = (msg) HI I am executing         #region To render the preview page         StringWriter sw = new StringWriter();         Server.Execute(@"~/Default2.aspx", sw);         #endregion To have the...
  3. Jquery click function is not working in below code..?? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <link type="text/css" href="App_Themes/jquery-ui-1.7.3.custom.css" rel="stylesheet" /> <script src="Scripts/jquery-1.3.2.min.js"type="text/javascript"></script> <script src="Scripts/jquery-ui-1.7.3.custom.min.js" type="text/javascript"></script> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Untitled Page</title>...
  4. newbie needs help with textbox I have a textbox that a user is going to use to enter search information.  when the page loads, "search Phrase" will already be inside the...
  5. doucument getelementbyid error I have page as shown below <%@ Page Language="C#" MasterPageFile="~/WebPages/MasterPage.master" AutoEventWireup="true" CodeFile="JavaScriptTest.aspx.cs" Inherits="WebPages_JavaScriptTest" Title="Untitled Page" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server"> <div align="center"> <p> <asp:Label ID="First"...

Leave a Reply