[SOLVED] Alernate soln for getElementByName

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

[SOLVED] Alernate soln for getElementByName

Post by anjanesh »

Code: Select all

<FORM NAME=frm1 METHOD=POST>
...somewhere here onClick="clickme(1)"
</FORM>

<FORM NAME=frm2 METHOD=POST>
...somewhere here onClick="clickme(2)"
</FORM>

<FORM NAME=frm3 METHOD=POST>
...somewhere here onClick="clickme(3)"
</FORM>
Is there any way I can have this in a JS code ?

Code: Select all

function clickme(n)
 &#123;
 document.(frm+n).whatever.value="something";
 // Should produce document.frm1.whatever.value="something";
 // Should produce document.frm2.whatever.value="something";
 // Should produce document.frm3.whatever.value="something";
 &#125;
Since getElementByName is unavilable how else can I have it done ?
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code: Select all

document.forms&#1111;'frm1']....
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Thank you Feyd.
Post Reply