|
1 <HTML> |
|
2 <HEAD> |
|
3 <STYLE> |
|
4 #first { display: inline; color: green; } |
|
5 #second { display: block; color: red; } |
|
6 </STYLE> |
|
7 <SCRIPT> |
|
8 var id = "first"; |
|
9 function toggleId() { |
|
10 var node = document.getElementById(id); |
|
11 if (id == "first") { |
|
12 id = "second"; |
|
13 } |
|
14 else { |
|
15 id = "first"; |
|
16 } |
|
17 node.id = id; |
|
18 } |
|
19 </SCRIPT> |
|
20 </HEAD> |
|
21 <BODY> |
|
22 <H1>Changing ID test</H1> |
|
23 <P>Clicking on the button that follows this paragraph |
|
24 should change the layout of <SPAN ID="first">these words</SPAN> |
|
25 with respect to the rest of the flow.</P> |
|
26 <FORM> |
|
27 <INPUT TYPE="button" VALUE="Toggle ID" onClick="toggleId(); return true;"> |
|
28 </FORM> |
|
29 </BODY> |
|
30 </HTML> |