Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

tell which form i'm clicking

Status
Not open for further replies.

jitteman

Programmer
Apr 20, 2008
4
US
The following script dynamically creates a select box and names it. I want to dynamically add an onfocus event handler that changes the value of the boxname variable to the value of the name of the form.
When I click the first form boxname=0, when I click the second boxname=1 ,etc.,etc.
Any help on this would be greatly appreciated.

<SCRIPT language="Javascript">
var boxname=0;
function createlist(){
newlist= document.createElement("SELECT");
newlist.name=boxname;
document.selectform.appendChild(newlist);
boxname++;
}
</SCRIPT>
 
Do you want to put the form's name in the variable, or do you really want to put the select element's name in the variable?

If the latter (even though you asked for the former), then the code I gave would need to be changed (e.g, "this.name").

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top