If just transferred from ASP the programmer of ASPX, cosmopolitan the ID that complains the client that ASPX makes carries an element, too long! If want to be in,client end is used in script, if use:
|
It is quotative content below: |
This kind means will cite, very no-go.
Envisage, you want to generate the interface of as above, be in in the mouse next on Button when Mousemove, change the corresponding text casing is medium character before its, the format is: The ID ‘ of this Button of ‘hello World ‘ - - ‘ New Date().valueOf()
Do not want a canal first, what do this have to use, use in where, headFirst, How do you come true?
My implementation method is like caption place character namely, accuse with the server will cope with them, want us to choose an appropriate train of thought only: Assume we have a server to accuse, accuse through giving appoint two photographs to accuse associatedly (here is Buton and TextBox) , we accuse for these two in client end, install the attribute that defines oneself to point to another to accuse directly respectively.
If had another to accuse cite, we can be in the example of Button, get associated TextBox directly cite, and GetElementById() of steer clear of.
See this serve end to accuse first use:
It is quotative content below: <Div> <Asp:REpeaterID= “Repeater1 “ Runat= “server “> <ItemTemplate> <Asp:TExtBoxID= “TextBox1 “ Runat= “server “ Width= “445px “> </Asp:TExtBox> <Asp:BUttonID= “Button1 “ Runat= “server “ Text= “Button “ Onmousemove= "return Button_onmousemove(this, event) “ / > <Cc1:WEbControlLinkerID= “WebControlLinker1 “ Runat= “server “ WebControlFirst= “Button1 “ WebControlSecond= “TextBox1 “ / > </ItemTemplate> </Asp:REpeater> </Div> |
NoticeCc1:WEbControlLinkerWebControlFirst= “Button1 “ WebControlSecond= “TextBox1 “ We installed two correlation accuse.
They can be when page output, generate the code below:
The page appears:
It is quotative content below: <Div> <InputName= “Repeater1$ctl00$TextBox1 “ Type= “text “ Id= “Repeater1_ctl00_TextBox1 “ Style= “width:445px; “ / > <InputType= “submit “ Name= “Repeater1$ctl00$Button1 “ Value= “Button “ Id= “Repeater1_ctl00_Button1 “ Onmousemove= "return Button_onmousemove(this, event) “ / > <SpanId= “Repeater1_ctl00_WebControlLinker1 “> </Span> <InputName= “Repeater1$ctl01$TextBox1 “ Type= “text “ Id= “Repeater1_ctl01_TextBox1 “ Style= “width:445px; “ / > <InputType= “submit “ Name= “Repeater1$ctl01$Button1 “ Value= “Button “ Id= “Repeater1_ctl01_Button1 “ Onmousemove= "return Button_onmousemove(this, event) “ / > <SpanId= “Repeater1_ctl01_WebControlLinker1 “> </Span> <InputName= “Repeater1$ctl02$TextBox1 “ Type= “text “ Id= “Repeater1_ctl02_TextBox1 “ Style= “width:445px; “ / > <InputType= “submit “ Name= “Repeater1$ctl02$Button1 “ Value= “Button “ Id= “Repeater1_ctl02_Button1 “ Onmousemove= "return Button_onmousemove(this, event) “ / > <SpanId= “Repeater1_ctl02_WebControlLinker1 “> </Span> <InputName= “Repeater1$ctl03$TextBox1 “ Type= “text “ Id= “Repeater1_ctl03_TextBox1 “ Style= “width:445px; “ / > <InputType= “submit “ Name= “Repeater1$ctl03$Button1 “ Value= “Button “ Id= “Repeater1_ctl03_Button1 “ Onmousemove= "return Button_onmousemove(this, event) “ / > <SpanId= “Repeater1_ctl03_WebControlLinker1 “> </Span> <InputName= “Repeater1$ctl04$TextBox1 “ Type= “text “ Id= “Repeater1_ctl04_TextBox1 “ Style= “width:445px; “ / > <InputType= “submit “ Name= “Repeater1$ctl04$Button1 “ Value= “Button “ Id= “Repeater1_ctl04_Button1 “ Onmousemove= "return Button_onmousemove(this, event) “ / > <SpanId= “Repeater1_ctl04_WebControlLinker1 “> </Span> </Div> |
It is quotative content below: <ScriptType= “text/javascript “>![]() < ! - - Document.getElementById(’Repeater1_ctl00_Button1′).setAttribute(’TextBox1′ , document.getElementById(’Repeater1_ctl00_TextBox1′)); Document.getElementById(’Repeater1_ctl00_TextBox1′).setAttribute(’Button1′ , document.getElementById(’Repeater1_ctl00_Button1′)); Document.getElementById(’Repeater1_ctl01_Button1′).setAttribute(’TextBox1′ , document.getElementById(’Repeater1_ctl01_TextBox1′)); Document.getElementById(’Repeater1_ctl01_TextBox1′).setAttribute(’Button1′ , document.getElementById(’Repeater1_ctl01_Button1′)); Document.getElementById(’Repeater1_ctl02_Button1′).setAttribute(’TextBox1′ , document.getElementById(’Repeater1_ctl02_TextBox1′)); Document.getElementById(’Repeater1_ctl02_TextBox1′).setAttribute(’Button1′ , document.getElementById(’Repeater1_ctl02_Button1′)); Document.getElementById(’Repeater1_ctl03_Button1′).setAttribute(’TextBox1′ , document.getElementById(’Repeater1_ctl03_TextBox1′)); Document.getElementById(’Repeater1_ctl03_TextBox1′).setAttribute(’Button1′ , document.getElementById(’Repeater1_ctl03_Button1′)); Document.getElementById(’Repeater1_ctl04_Button1′).setAttribute(’TextBox1′ , document.getElementById(’Repeater1_ctl04_TextBox1′)); Document.getElementById(’Repeater1_ctl04_TextBox1′).setAttribute(’Button1′ , document.getElementById(’Repeater1_ctl04_Button1′)); / / - - > </Script> |
Had the thing above, , the script that we should carry out can write simply into such:
| It is quotative content below: <Head> <Title> Untitled Page </Title>![]() <ScriptType= “text/javascript “> Function Button_onmousemove(obj, e)![]() { Obj.TextBox1.value= =Hello World Hello World Obj.TextBox1.Button1.id ‘- -‘ New Date().valueOf();; } </Script>![]() </Head> |
Obj.TextBox1.value this kind of means, visit, also hold out bright?
Ask an author to contact this station, seasonable annotations your full name, contact mailbox: POst@chinaz.com.





}