ad.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. //双击滚屏
  2. var currentpos, timer;
  3. function initialize(){
  4. timer = setInterval("scrollwindow()", 50);
  5. }
  6. function sc(){
  7. clearInterval(timer);
  8. }
  9. function scrollwindow(){
  10. currentpos = document.body.scrollTop;
  11. window.scroll(0, ++currentpos);
  12. if (currentpos != document.body.scrollTop)
  13. sc();
  14. }
  15. document.onmousedown = sc
  16. document.ondblclick = initialize
  17. var background = new Array;
  18. background[0]="images/bg.gif";
  19. background[1]="images/c1.jpg";
  20. background[2]="images/c2.jpg";
  21. background[3]="images/c3.gif";
  22. background[4]="images/c4.gif";
  23. background[5]="images/c5.gif";
  24. background[6]="images/c6.gif";
  25. background[7]="images/c7.gif";
  26. var dsize=11;
  27. function reduce()
  28. {
  29. dsize--;
  30. txt.style.cssText='{font-size:'+dsize+'pt;}';
  31. parent.FontSize=dsize;
  32. }
  33. function enlarge()
  34. {
  35. dsize++;
  36. txt.style.cssText='{font-size:'+dsize+'pt;}';
  37. parent.FontSize=dsize;
  38. }
  39. function switchschema()
  40. {
  41. var i = userbg.selectedIndex;
  42. parent.schema=i;
  43. body1.background=background[i];
  44. }
  45. function loadchapter()
  46. {
  47. var i=parent.schema;
  48. if(i!=null)
  49. {
  50. body1.background =background[i];
  51. userbg.selectedIndex=i;
  52. }
  53. if(parent.FontSize!=null)
  54. {
  55. var pat=/[0-9]+/gi;
  56. if(pat.exec(parent.FontSize))
  57. {
  58. dsize=parent.FontSize;
  59. txt.style.cssText='{font-size:'+dsize+'pt;}';
  60. }
  61. }
  62. }