SV: [thelist] javascript - how to refer to (x)html elements

Marcus Andersson marcan at home.se
Tue Nov 11 23:11:37 CST 2003


var element = document.getElementById("example")

But you cannot have two elements with the same id. The form could be
named exampleForm instead.

/Marcus

-----Ursprungligt meddelande-----
Från: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] För Tim Burgan
Skickat: den 12 november 2003 05:48
Till: [thelist] - Web Discussion
Ämne: [thelist] javascript - how to refer to (x)html elements


hello,

as i've been trying to learn JavaScript - i'm a little stuck.. again

I don't know how to explain this, but instead of:

  document.formName.inputName.value
  (eg. <form name="example"> <input name="example">)

i want to use:

  document.formId.inputId.value
  (eg. <form id="example"> <input id="example" />)

the reason being, that to use the first example I must use
non-standards-compliant xhtml code in my documents.

So is there a way that JavaScript can use xhtml tag's ID elements rather
than the depreciated NAME element?

Thanks
Tim Burgan


-- 
* * Please support the community that supports you.  * *
http://evolt.org/help_support_evolt/

For unsubscribe and other options, including the Tip Harvester 
and archives of thelist go to: http://lists.evolt.org 
Workers of the Web, evolt ! 



More information about the thelist mailing list