|
| 1 | +<!DOCTYPE html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> |
| 5 | + <title>Original</title> |
| 6 | + <!-- Note the timeouts in the functions are chosen such they constitute |
| 7 | + a set with distinct subset sums. That is is a combination of any two |
| 8 | + or more were to be executed the total time for that distinct combination |
| 9 | + would be unique. This was done so we could do a ALL/AND/OR type of test |
| 10 | + and know that with the combination of expected conditions the execution |
| 11 | + was successful as the unique time took place. --> |
| 12 | + <!-- The set we are using is {6,9,11,12,13} --> |
| 13 | + <!-- (could also use {3,5,6,7} which would reduce total time)--> |
| 14 | + <script type="text/javascript"> |
| 15 | + function add_content(target_container, content) { |
| 16 | + p = document.createElement('p'); |
| 17 | + p.appendChild(document.createTextNode(content)); |
| 18 | + container = document.getElementById(target_container); |
| 19 | + container.appendChild(p); |
| 20 | + } |
| 21 | + |
| 22 | + function delayed_button_state() { |
| 23 | + setTimeout(function() { |
| 24 | + state_btn = document.getElementById('enabledDisabledBtn') |
| 25 | + if (state_btn.hasAttribute("disabled")) { |
| 26 | + state_btn.removeAttribute("disabled") |
| 27 | + state_btn.value = "Enabled" |
| 28 | + } else { |
| 29 | + state_btn.setAttribute("disabled", "") |
| 30 | + state_btn.value = "Disabled" |
| 31 | + } |
| 32 | + },900) |
| 33 | + } |
| 34 | + function delayed_title_change() { |
| 35 | + setTimeout(function(){ |
| 36 | + document.title='Delayed'; |
| 37 | + },600); |
| 38 | + } |
| 39 | + |
| 40 | + function delayed_add_element() { |
| 41 | + setTimeout(function(){ |
| 42 | + const newElem = document.createElement("input"); |
| 43 | + newElem.setAttribute("type", "button"); |
| 44 | + newElem.setAttribute("id", "added_btn"); |
| 45 | + newElem.setAttribute("value", "Added Button"); |
| 46 | + const container = document.getElementById("container"); |
| 47 | + document.body.insertBefore(newElem, container); |
| 48 | + },1100); |
| 49 | + } |
| 50 | + </script> |
| 51 | + </head> |
| 52 | + <body> |
| 53 | + <a href="javascript:return false;" onclick="document.title='Changed'; return false;">change title</a><br/> |
| 54 | + <a href="javascript:return false;" onclick="delayed_title_change(); return false;">delayed change title</a><br/> |
| 55 | + <a href="javascript:return false;" onclick="delayed_add_element(); return fales;">delayed add element</a><br/> |
| 56 | + <a href="javascript:return false;" onclick="add_content('target', 'added content'); return false;">add content</a><br/> |
| 57 | + <a id="unicode" href="javascript:return false;" onclick="document.title='äää'; return false;">title to ääää</a><br/> |
| 58 | + <p> |
| 59 | + <input type="radio" name="group" value="title" |
| 60 | + onclick="document.title='Changed by Button';" />Change Title<br/> |
| 61 | + <input type="radio" name="group" value="content" |
| 62 | + onclick="add_content('button_target', 'added by button');"/>Add Content<br/> |
| 63 | + </p> |
| 64 | + <div id="target"> |
| 65 | + </div> |
| 66 | + <div id="button_target"> |
| 67 | + </div> |
| 68 | + <form name=myform> |
| 69 | + <input type=button value="Change the title" |
| 70 | + onClick="if(confirm('Really change the title?')) |
| 71 | + document.title += ' Changed!';" > |
| 72 | + </form> |
| 73 | + <p> |
| 74 | + <input type=button id=stateChangeBtn value="Change the button state" |
| 75 | + onClick="delayed_button_state()" /> |
| 76 | + <input type=button id=enabledDisabledBtn value="Disabled" |
| 77 | + disabled /> |
| 78 | + </p> |
| 79 | + <p> |
| 80 | + <div id="container"></div> |
| 81 | + </p> |
| 82 | + <p> |
| 83 | + <form name=titleChanger> |
| 84 | + <td> |
| 85 | + <input type=text id=titleChangeTxt value="Enter Title here"> |
| 86 | + </td> |
| 87 | + <td> |
| 88 | + <input type=button id=titleChangeBtn value="Set Title" |
| 89 | + onClick="document.title = document.getElementById('titleChangeTxt').value;" > |
| 90 | + </td> |
| 91 | + </form> |
| 92 | + </p> |
| 93 | + </body> |
| 94 | +</html> |
| 95 | + |
0 commit comments