dom/tests/js/id.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/tests/js/id.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,30 @@
     1.4 +<HTML>
     1.5 +<HEAD>
     1.6 +<STYLE>
     1.7 + #first  { display: inline; color: green; }
     1.8 + #second { display: block; color: red; }
     1.9 +</STYLE>
    1.10 +<SCRIPT>
    1.11 +var id = "first";
    1.12 +function toggleId() {
    1.13 +  var node = document.getElementById(id);
    1.14 +  if (id == "first") {
    1.15 +    id = "second";
    1.16 +  }
    1.17 +  else {
    1.18 +    id = "first";
    1.19 +  }
    1.20 +  node.id = id;
    1.21 +}
    1.22 +</SCRIPT>
    1.23 +</HEAD>
    1.24 +<BODY>
    1.25 +<H1>Changing ID test</H1>
    1.26 +<P>Clicking on the button that follows this paragraph 
    1.27 +should change the layout of <SPAN ID="first">these words</SPAN>
    1.28 +with respect to the rest of the flow.</P>
    1.29 +<FORM>
    1.30 +<INPUT TYPE="button" VALUE="Toggle ID" onClick="toggleId(); return true;">
    1.31 +</FORM>
    1.32 +</BODY>
    1.33 +</HTML>

mercurial