[Javascript] how to refer to (x)html elements

Cutter (JavaScript List) java.script at seacrets.com
Wed Nov 12 09:40:20 CST 2003


x = document.getElementById('example');
valX = x.value;

This may not be exactly right so you may want to check out 
quirksmode.org for further clarification.

Cutter

Tim Burgan wrote:

>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
>
>_______________________________________________
>Javascript mailing list
>Javascript at LaTech.edu
>https://lists.LaTech.edu/mailman/listinfo/javascript
>  
>





More information about the Javascript mailing list