Change Div position randomly on home page.here is simple example which display a div randomly on homepage within available width and hight.
CODE:
CODE:
1 : <Script Langauge="javscript">
2 : var load=true;
3 : var div_width=300;
4 : var div_height=200;
5 : var top=Math.floor(Math.random()*screen.availHeight - div_height)
6 : var left=Math.floor(Math.random()*screen.availWidth - div_width)
7 : document.write("<div id='pic_div' style='border:1px solid black;position:absolute;width:"+div_width+";height:"+div_height+";
8 : text-align:center;left:0px;top:0px'>a</div>");
9 : var d_obj=document.getElementById("pic_div");
10 : d_obj.style.top=top;
11 : d_obj.style.left=left;
12 : </script>
not working on firefox
ReplyDelete