Jump to content

getElementByName?


Howdy_McGee

Recommended Posts

I was wondering if it's possible to get an element by name, sorta like a toTop link. (Ex. href="#top" - somwhere else on page - name="top")I'm trying to write a hover script and link the href="#ID" to another div with the name="ID", is there anyway to do this?

Link to comment
Share on other sites

You should just use the ID attribute. The name attribute is deprecated in favor of ID for all elements except <input>, <select> and <textarea>

Link to comment
Share on other sites

You should just use the ID attribute. The name attribute is deprecated in favor of ID for all elements except <input>, <select> and <textarea>
I'm not sure that's actually correct...according to the spec it's only deprecated for the elements: a, applet, form, frame, iframe, img, and map. It's still used for all other form elements (radio, checkbox, text, etc).
Link to comment
Share on other sites

I'm not sure that's actually correct...according to the spec it's only deprecated for the elements: a, applet, form, frame, iframe, img, and map. It's still used for all other form elements (radio, checkbox, text, etc).
And the radio, checkbox, text, etc. are implemented by which elements? ... The "input" (with different types such as radio, checkbox, etc.), "select" and "textarea", which is what DD said.(If you can see an element that is not one of these, and does not deprecate the use of the form element on it, then you'd be right...)
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...