Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Fri, 25 Nov 2005 14:16:01 -0000,    group: microsoft.public.inetsdk.programming.scripting.jscript        back       


id problem   
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
date: Fri, 25 Nov 2005 14:16:01 -0000   author:   Avon

Re: id problem   
:-)

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
>
>
>
date: Sat, 25 Mar 2006 19:56:01 GMT   author:   Sverine ess

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us