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>
<input type="date" name="set_date" value="2012-10-15" />
h2 { text-shadow: 2px 3px 3px #a0a1fe; }
var pags = ["lessons", "courses"]; pags.push("download", "tutorials"); alert(pags[2]); // download
$lang =[10=>"PHP", 20=>"JavaScript", "site"=>"coursesweb.net"); ksort($lang); var_export($lang); // array ("site"=>"coursesweb.net", 10=>"PHP", 20=>"JavaScript")