Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Controling the cursor on a web page
Message
From
27/12/2000 15:22:38
 
 
To
27/12/2000 13:30:46
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00457039
Message ID:
00457142
Views:
35
Jim,

>1) Position the cursor at a specific field (for entry) on a web page?

In addition to the other suggestions, you can specify the first entry field to be positioned when the page loads by attaching script to the "onload" event. This example is for a page with a form "Lookup" with an input field called "inputval":
< html >
< head >whatever...< /head >
< script language="JavaScript" >
function window.onload()
{ document.forms("Lookup").elements("inputval").focus() }
< /script >
< body >etc...
You can attach code to various events related to controls, although that may not work correctly with all browsers. This allows you, for example, to use the "onblur" event to fire script when the user navigates off of a field, although that might not be what you want if they click somewhere else on the page. But anyway, you can play with this.

Here is a slight variation of Trey's page, which starts in the first input field (entername), tabs to the third field (enterphone) because of tabindex=2, then fires an onblur event when tabbing from enterphone, which sends it back to the first field. Not very useful, but demonstrates the techniques. :-)

Note the onload event code in the body tag in this example. Also note alternate ways of referring to the same element, which may not always work in every browser:
< html >
< body onload='document.forms(0).elements("entername").focus()' >
< form >
Name: < input type="textbox" name="entername"  tabindex=1 >
Address: < input type="textbox" name="enteraddr" tabindex=3 >
Phone: < input type="textbox" 
name="enterphone" tabindex=2 onblur='entername.focus()' >
< /form >
< /body >
< /html >
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Previous
Reply
Map
View

Click here to load this message in the networking platform