|
|||||||
| HTML Discussion and technical support for building, using and deploying HTML sites. |
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Setting focus to field on tabular form
I have an html form with several columns. The rows of data are created in php and sent to the form. Each column is an array. How do I set the focus to a specific data cell?
I know about the javascript to setfocus on the body tag, but how do I have it set the focus to a particular cell of an array? Last edited by dkperez; 02-08-2010 at 07:01 PM. |
|
#2
|
||||
|
||||
|
With html use a bookmark: url#elementID
Javascript offers more options depending on when the focus is required and the type of element.
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
|
#3
|
|||
|
|||
|
I got the initial focus to set on the body tag using this:
<body OnLoad="document.salonentry.Title0.focus();"> But, when the user hits the button to display a new row (empty, for entering a new record), how do I change the focus so when we come back from the php and display the data, how do I put the focus in the first field of the new row, which is a select list? |
|
#4
|
||||
|
||||
|
Quote:
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
|
#5
|
|||
|
|||
|
It's not Ajax, so I'm presuming it's form submission. I'm using POST in the form definition.
|
|
#6
|
||||
|
||||
|
This would focus on the last input element:
Code:
window.onload=function() {
var aObj = document.getElementsByTagName('input');
aObj[aObj.length-1].focus();
};
__________________
At least 98% of internet users' DNA is identical to that of chimpanzees |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|