Hi there, Sorry for my not perfect English. I just want to ask how to refer to object.id if in some script we change id from other object to the same id. I mean: <html> <head> <script> function bla(tt){ tt.id="asd"; alert(document.getElementById('asd').value); } </script> </head> <body> <input type="button" value="aaaaa" id="vvv" onclick="bla(this);"> <input type="button" value="bbbbb" id="asd" onclick="bla(this);"> </body> </html> In this code I change button with id "vvv" to "asd" and after that I can't access the original button with id "asd". My main question is what is the id of the second button now? If I first click button with id "vvv" the script change id of this button to "asd" and display "aaaaa", if then I click the second button I thought it will change second button id (from I don't know what) to "asd" and will display "bbbbb", but instead it actually display again "aaaaa". Please if is possible help me
:-) This will probably not answer your question, but as far as I know, an id is supposed to be unique, i.e. you're not supposed to give two elements the same id. The clue is in the name of the function getElementById; notice how it says "element", not "elements"; it will only ever return one element; the first one it finds with the id. You should probably use class instead of id. Marc. (not a pro) "Avon" wrote in message news:Ow9dDrc8FHA.4084@TK2MSFTNGP10.phx.gbl... > Hi there, > > Sorry for my not perfect English. > > I just want to ask how to refer to object.id if in some script we change id > from other object to the same id. I mean: > > <html> > > <head> > > <script> > > function bla(tt){ > > tt.id="asd"; > > alert(document.getElementById('asd').value); > > } > > </script> > > </head> > > <body> > > <input type="button" value="aaaaa" id="vvv" onclick="bla(this);"> > > <input type="button" value="bbbbb" id="asd" onclick="bla(this);"> > > </body> > > </html> > > > > In this code I change button with id "vvv" to "asd" and after that I can't > access the original button with id "asd". > > My main question is what is the id of the second button now? > > If I first click button with id "vvv" the script change id of this button > to "asd" and display "aaaaa", if then I click the second button I thought it > will change second button id (from I don't know what) to "asd" and will > display "bbbbb", but instead it actually display again "aaaaa". > > > > Please if is possible help me > > >