473,379 Members | 1,191 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

Javascript for onfocus

Hello Friends,

I have developed a web page using c#. My problem is that as the page gets loaded I am not able to get the cursor to the specified textbox,how should I do that using java script?plz some one help me out
thanks in advance
raghul
Dec 27 '07 #1
2 1129
Hi,
On body load call a javascript function to set the focus to the textbox u desire.
<body onload="javascript:setfocus();">

Or simply set the focus to the textbox like this

<body onload="document.getElementById('txtUser').focus() ;">
Dec 27 '07 #2
Plater
7,872 Expert 4TB
I believe in visual studio there's a property that you can set that tells a control to be the defaul focus (which means that visual studio will produce the javascript code, that mentioned previously, for you)
Dec 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Maria Bitsku | last post by:
How do I deactivate a window using Javascript. For example if I have a window that opens up another window, how do I prevent the user from clicking (doing anything) in the original window until...
1
by: Oliver Hoehle | last post by:
Hello! This ist the source-code for an editable combobox implemented with HTML,CSS and Javascript. I have tested it with IE and Mozilla. But I don't know, if it will work in other browsers...
2
by: Omar | last post by:
Hi! I have a JavaScript function that receives an Array with words. This Array can be gotten from a query to a DB using JSP. The JavaScript function is executed when onFocus event occurs:...
3
by: effendi | last post by:
Hi Can any tell me what is the javascript equivalent of CSS border? I would like to change the border of my cell when it is set on focus. I have tried onFocus="style.border='3px'" but it is not...
7
by: Sandy | last post by:
Hello - I have a form that when submitted checks the database and if the username is already taken, a label shows indicating same. I need to make that label NOT visible after the user clicks...
24
by: firstcustomer | last post by:
Hi, Firstly, I know NOTHING about Javascript I'm afraid, so I'm hoping that someone will be able to point me to a ready-made solution to my problem! A friend of mine (honest!) is wanting to...
5
by: rocknbil | last post by:
Hello everyone! I'm new here but have been programming for the web in various languages for 15 years or so. I'm certainly no "expert" but can keep myself out of trouble (or in it?) most of the time....
2
by: Josh Mitchell | last post by:
Hello, I'm trying to combine two javascript functions to occur on the same onfocus form field event. My code is below. I have one script which highlights the current form field div, and another...
3
by: =?Utf-8?B?aUhhdkFRdWVzdGlvbg==?= | last post by:
How can I use this same javascript in the asp.net 2.0, where I have a master page. <html > <script language="javascript" type="text/javascript"> function functionName(cnt_id) {} function...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.