Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <script type="text/javascript">
- var div;
- var divRef;
- var selct;
- var delay = 0;
- function init() {
- div=document.getElementById("target");
- divRef=document.getElementById("reference");
- selct=document.getElementById("src");
- var html="";
- for(var i=0; i<=100; i++) {
- html += "<option value=\"" + (i*10) + "\">" + (i*10) + "ms</option>";
- }
- selct.innerHTML = html;
- }
- function setLag() {
- delay = selct.options[selct.selectedIndex].value;
- }
- function go() {
- setTimeout(setClick, delay);
- divRef.style.backgroundColor = "pink";
- }
- function setClick() {
- div.style.backgroundColor = "pink";
- setTimeout(resume, 500);
- }
- function resume() {
- div.style.backgroundColor = "lightblue ";
- divRef.style.backgroundColor = "lightblue ";
- }
- </script>
- </head>
- <body onload="init()">
- <table>
- <tr>
- <th>Latence <select id="src" size="1" onchange="setLag()"></select></th>
- <th>Latence 0ms</th>
- </tr>
- <tr>
- <td><div style="width:200px;height:50px;background-color:lightblue" id="target" onclick="go()">Cliquer-ici</div></td>
- <td><div style="width:200px;height:50px;background-color:lightblue" id="reference">Référence</div></td>
- </tr>
- </table>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment