Here is a simple JavaScript function that can be used to move a html element to a random direction in page.
//sets a random absolute position to a html element; receives the html element function moveElmRand(elm){ elm.style.position ='absolute'; elm.style.top = Math.floor(Math.random()*90+5)+'%'; elm.style.left = Math.floor(Math.random()*90+5)+'%'; }
<h4>Example auto-moving html element</h4> <p>Try to click on the following button.</p> <button id='btn_test'>Catch Me</button> <script> //sets a random absolute position to a html element; receives the html element function moveElmRand(elm){ elm.style.position ='absolute'; elm.style.top = Math.floor(Math.random()*90+5)+'%'; elm.style.left = Math.floor(Math.random()*90+5)+'%'; } //get the #btn_test var btn_test = document.querySelector('#btn_test'); //register to call moveElmRand() on mouseenter event to #btn_test btn_test.addEventListener('mouseenter', function(e){ moveElmRand(e.target);}); //register click to #btn_test btn_test.addEventListener('click', function(e){ alert('You are Good.');}); </script>
<table><tr> <th>Title 1</th> <th>Title 2</th> </tr></table>
.some_class { line-height: 150%; }
document.getElementById("id_button").onclick = function(){ window.open("http://coursesweb.net/"); }
$ar_dir = scandir("dir_name"); var_export($ar_dir);