Joe

Many thanks again. I had wondered if something like this was possible but had no idea how it might be done.

This may be a bit advanced for me as yet, but I do understand what your code is doing and once I have got getElementsByName working I might well be brave enough to give it a try and revert to ID

Best wishes

Rob

Joe Lee wrote:

The name attribute is not specified as an attribute for every element,
and there may be problems with using it on every element in XHTML. I
know that there are a few instances where it is specified, such as <a>
anchor, <button>, and <input> elements. With the <input> elements the
name attribute is necessary because it is used to identify the value
when the form is submitted. However even when an element requires the
name attribute, I would recommend also using the id attribute. However
as Walden points out there may be a problem if the <input> tags are
generated by WSG. Though in that case you could possibly do something
like this:

function generateIdsForInputElements()
{
 var inputs = document.getElementsByTagName("input");
 var i =0;
 for (i=0:i <inputs.length:i++)
 {
  inputs(i).id = inputs(i).name;
 }
}









As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.