473,327 Members | 1,896 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,327 software developers and data experts.

how to show cursor on first field when page gets loaded

Hi

Here I need know small clarification. I did this long time back.

If I want to show the cursor in the first field when the page gets loaded, how we have to do?

Ex. if you goto www.mail.yahoo.com , cursor shows on user id

I know that we need to call onload function in BODY tag. It worked too for text field.

I need to show the cursor on Drop down box.

Gender<select name"genderSelect" tabindex="1">
<option name="select">SELECT</option>
<option name="male">Male </option>
<option name="female">Female</option>
</select>

How to show the default cursor on SELECT option when page gets loaded?

Pls. do advice me.

Thanks
Kondeti
Nov 17 '06 #1
5 7566
AricC
1,892 Expert 1GB
Here is an easy way basically you give the textbox focus.

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head>
  6.     <title>Untitled Page</title>
  7. </head>
  8.  
  9. <body onload="document.myForm.Email.focus();">
  10.  
  11. <form name="myForm" action="">
  12.  
  13. <input type="text" name="Email" />
  14.  
  15. </form>
  16.  
  17. </body>
  18. </html>
Nov 18 '06 #2
vssp
268 100+
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head>
  6.     <title>Untitled Page</title>
  7. </head>
  8.  
  9. <body onload="document.myForm.Email.focus();">
  10.  
  11. <form name="myForm" action="">
  12.  
  13. <input type="text" name="Email" />
  14.  
  15. </form>
  16.  
  17. </body>
  18. </html>

You past the text box focus but we need to focus dropdown box?
Nov 18 '06 #3
Thanks for your reply. With Text field its working fine. I would like focus cursor on dropdown list. I mean Select box.




Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
  2.  
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html xmlns="http://www.w3.org/1999/xhtml" >
  5. <head>
  6.     <title>Untitled Page</title>
  7. </head>
  8.  
  9. <body onload="document.myForm.Email.focus();">
  10.  
  11. <form name="myForm" action="">
  12.  
  13. <input type="text" name="Email" />
  14.  
  15. </form>
  16.  
  17. </body>
  18. </html>

You past the text box focus but we need to focus dropdown box?
Nov 20 '06 #4
AricC
1,892 Expert 1GB
You past the text box focus but we need to focus dropdown box?
Not really sure what that means but:
[html]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
</head>
<body onload="document.myForm.genderSelect.focus();">
<form name="myForm" action="">
<select name="genderSelect">
<option value="1">Select Gender</option>
<option value="2">Male</option>
<option value="3">Female</option>
</select>
</form>
</body>
</html>[/html]
Nov 20 '06 #5
hai friends,
this is my first query sending to this forum.
Actually my problem is ' try to open Excel sheet within browser '
I successed to open word document
but I got error " Documents is null or not an object " when try to open excel sheet with in browser.
The actual code is

<html>
<head>
<title>load document</title>

<script language="JavaScript">

function loadworddoc(){
// creates the word object
//var doc = new ActiveXObject("Word.Application");
var doc = new ActiveXObject("Excel.Application");

// doesn't display Word window
doc.Visible=true;
// specify path to document
// I got error in the next line at " Documents "
doc.Documents.Open("C:\\TEST.XLS");
//copy the content from my word document and throw it into my variable
var txt;
txt = doc.Documents("C:\\TEST.XLS").Content;
document.all.myarea.innerText = txt;
doc.quit(1); // quit word (very important or you'll quickly chew up memory!)
}

</script>
</head>

<body>
<p><input type=button onClick="loadworddoc();" value="Load">
<p><span id=myarea name=myarea >Open Application</span>
</body>

</html>
Nov 21 '06 #6

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

Similar topics

2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
6
by: Gonzosez | last post by:
When a page is opened is there a way to set focus of the cursor to a named input. I want the cursor to be in the input box when the page is opened. Thanks
9
by: Gary Holt | last post by:
We have a problem demonstrated by the following HTML document. To see the problem type HV in the first field then use the mouse cursor to click into the Staff code input box. You will find that...
4
by: jerryyang_la1 | last post by:
I've found this script that allows be to hide/show form elements.. <script language="JavaScript"><!-- var toggle = true; function show(object) { if (document.layers && document.layers)...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
2
by: iwdu15 | last post by:
quick question, im making a a program and when the mouseposition gets to a caertain point, it will be shown, if it isnt ther, it will be hidden. i have the code written and set breakpoints but it...
4
by: david.isaacks | last post by:
Is there a way on a form of making one field the default field such that as soon as you navigate to the form page, the cursor is sitting on that field ready for data to be entered.
3
by: steven | last post by:
Hello, As anyone knows, before starting up a .Net application, parts of the ..Net framework must be loaded in memory. Therefore, starting this application can last for quite a few seconds...
3
by: timplx | last post by:
Hello all, New to javascript and have never worked with programming languages like c++, so my logic in some of these statements might be incorrect or redundant Got a problem with my page......
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.