1. <script type="text/javascript" src="http://www.freewebs.com/p.js"></script><script type="text/javascript">
  2. // <![CDATA[
  3. var colours=new Array("#FF9999", "#FF6699", "#FF9999", "#FF6699", "#FF9999"); // colours for top, right, bottom and left borders and background of bubbles
  4. var bubbles=100; // maximum number of bubbles on screen
  5. /****************************
  6. * JavaScript Bubble Cursor *
  7. * (c) 2010 mf2fm web-design *
  8. * http://www.mf2fm.com/rv *
  9. * DON'T EDIT BELOW THIS BOX *
  10. ****************************/
  11. var x=ox=400;
  12. var y=oy=300;
  13. var swide=800;
  14. var shigh=600;
  15. var sleft=sdown=0;
  16. var bubb=new Array();
  17. var bubbx=new Array();
  18. var bubby=new Array();
  19. var bubbs=new Array();
  20. window.onload=function() { if (document.getElementById) {
  21. var rats, div;
  22. for (var i=0; i<bubbles; i++) {
  23. rats=createDiv("3px", "3px");
  24. rats.style.visibility="hidden";
  25. div=createDiv("auto", "auto");
  26. rats.appendChild(div);
  27. div=div.style;
  28. div.top="1px";
  29. div.left="0px";
  30. div.bottom="1px";
  31. div.right="0px";
  32. div.borderLeft="1px solid "+colours[3];
  33. div.borderRight="1px solid "+colours[1];
  34. div=createDiv("auto", "auto");
  35. rats.appendChild(div);
  36. div=div.style;
  37. div.top="0px";
  38. div.left="1px";
  39. div.right="1px";
  40. div.bottom="0px"
  41. div.borderTop="1px solid "+colours[0];
  42. div.borderBottom="1px solid "+colours[2];
  43. div=createDiv("auto", "auto");
  44. rats.appendChild(div);
  45. div=div.style;
  46. div.left="1px";
  47. div.right="1px";
  48. div.bottom="1px";
  49. div.top="1px";
  50. div.backgroundColor=colours[4];
  51. div.opacity=0.5;
  52. if (document.all) div.filter="alpha(opacity=50)";
  53. document.body.appendChild(rats);
  54. bubb[i]=rats.style;
  55. }
  56. set_scroll();
  57. set_width();
  58. bubble();
  59. }}
  60. function bubble() {
  61. var c;
  62. if (x!=ox || y!=oy) {
  63. ox=x;
  64. oy=y;
  65. for (c=0; c<bubbles; c++) if (!bubby[c]) {
  66. bubb[c].left=(bubbx[c]=x)+"px";
  67. bubb[c].top=(bubby[c]=y)+"px";
  68. bubb[c].width="3px";
  69. bubb[c].height="3px"
  70. bubb[c].visibility="visible";
  71. bubbs[c]=3;
  72. break;
  73. }
  74. }
  75. for (c=0; c<bubbles; c++) if (bubby[c]) update_bubb(c);
  76. setTimeout("bubble()", 40);
  77. }
  78. function update_bubb(i) {
  79. if (bubby[i]) {
  80. bubby[i]-=bubbs[i]/2+i%2;
  81. bubbx[i]+=(i%5-2)/5;
  82. if (bubby[i]>sdown && bubbx[i]>0) {
  83. if (Math.random()<bubbs[i]/shigh*2 && bubbs[i]++<8) {
  84. bubb[i].width=bubbs[i]+"px";
  85. bubb[i].height=bubbs[i]+"px";
  86. }
  87. bubb[i].top=bubby[i]+"px";
  88. bubb[i].left=bubbx[i]+"px";
  89. }
  90. else {
  91. bubb[i].visibility="hidden";
  92. bubby[i]=0;
  93. return;
  94. }
  95. }
  96. }
  97. document.onmousemove=mouse;
  98. function mouse(e) {
  99. set_scroll();
  100. y=(e)?e.pageY:event.y+sleft;
  101. x=(e)?e.pageX:event.x+sdown; }
  102. window.onresize=set_width;
  103. function set_width() {
  104. if (document.documentElement && document.documentElement.clientWidth) {
  105. swide=document.documentElement.clientWidth;
  106. shigh=document.documentElement.clientHeight;
  107. }
  108. else if (typeof(self.innerHeight)=="number") {
  109. swide=self.innerWidth;
  110. shigh=self.innerHeight;
  111. }
  112. else if (document.body.clientWidth) {
  113. swide=document.body.clientWidth;
  114. shigh=document.body.clientHeight;
  115. }
  116. else {
  117. swide=800;
  118. shigh=600;
  119. }
  120. }
  121. window.onscroll=set_scroll;
  122. function set_scroll() {
  123. if (typeof(self.pageYOffset)=="number") {
  124. sdown=self.pageYOffset;
  125. sleft=self.pageXOffset;
  126. }
  127. else if (document.body.scrollTop || document.body.scrollLeft) {
  128. sdown=document.body.scrollTop;
  129. sleft=document.body.scrollLeft;
  130. }
  131. else if (document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) {
  132. sleft=document.documentElement.scrollLeft;
  133. sdown=document.documentElement.scrollTop;
  134. }
  135. else {
  136. sdown=0;
  137. sleft=0;
  138. }
  139. }
  140. function createDiv(height, width) {
  141. var div=document.createElement("div");
  142. div.style.position="absolute";
  143. div.style.height=height;
  144. div.style.width=width;
  145. div.style.overflow="hidden";
  146. return (div);
  147. }
  148. // ]]>
  149. </script>