I have a login page. Whenever the page loads, the cursor should blink in the first textbox only that is for entering a userid.
I’ve written javascript like this, but I am using Master Pages now.
this is my script:
function fcus(x)
{
x.focus();
}
<asp:TextBox id="textbox1" onload="javascript:fcus(this);">
and where I have to call this method, I write on onload event of textbox but it gives an error.
Can you tell me where I have to call this method?
Why don’t you use form’s DefaultFocus property (ASP.NET 2.0 and above)?
You might need to do this programmatically, depending on your scenario.
Look into:
To do it programmatically.