| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|---|
| 2 | <html>
|
|---|
| 3 | <head>
|
|---|
| 4 | <title>Tester</title>
|
|---|
| 5 | <style type="text/css">
|
|---|
| 6 | div { background:yellow; width:400px; margin:5px; }
|
|---|
| 7 | #hid { display:none; }
|
|---|
| 8 | </style>
|
|---|
| 9 | <script type="text/javascript" src="../jquery.js"></script>
|
|---|
| 10 | <script type="text/javascript">
|
|---|
| 11 | function show(id, value) {
|
|---|
| 12 | if (value) {
|
|---|
| 13 | value = value + " = '" + eval(value) + "'";
|
|---|
| 14 | }
|
|---|
| 15 | $(id).text(value);
|
|---|
| 16 | }
|
|---|
| 17 |
|
|---|
| 18 | $(function () {
|
|---|
| 19 | $("button:eq(0)").click(function () {
|
|---|
| 20 | show("#adiv", '$("#hid").css("display")');
|
|---|
| 21 | // set the innerHTML to itself
|
|---|
| 22 | $("#container")[0].innerHTML = $("#container")[0].innerHTML;
|
|---|
| 23 | show("#bdiv", '$("#hid").css("display")');
|
|---|
| 24 | // set the element to "block" then reset it (should change nothing in the end)
|
|---|
| 25 | var elem = $("#hid")[0];
|
|---|
| 26 | var save = elem.style.display;
|
|---|
| 27 | elem.style.display = "block";
|
|---|
| 28 | elem.style.display = save;
|
|---|
| 29 | show("#cdiv", '$("#hid").css("display")');
|
|---|
| 30 | });
|
|---|
| 31 | });
|
|---|
| 32 | </script>
|
|---|
| 33 | </head>
|
|---|
| 34 | <body>
|
|---|
| 35 | <button>Demo problem</button>
|
|---|
| 36 | <p>
|
|---|
| 37 | Click 'Demo problem' and should get 'none' all 3 times
|
|---|
| 38 | </p>
|
|---|
| 39 | <div id="container" style="display:none;">
|
|---|
| 40 | <div>
|
|---|
| 41 | <div id="hid">hidden</div>
|
|---|
| 42 | </div>
|
|---|
| 43 | </div>
|
|---|
| 44 | <div id="adiv"></div>
|
|---|
| 45 | <div id="bdiv"></div>
|
|---|
| 46 | <div id="cdiv"></div>
|
|---|
| 47 | </body>
|
|---|
| 48 | </html>
|
|---|