home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 October / tst.iso / external.js < prev    next >
Encoding:
JavaScript  |  2000-08-01  |  4.7 KB  |  172 lines

  1. // Your messages. Add as many as you like
  2. var message=new Array()
  3. message[0]="Welcome to the APC DVD ... click the above icons or text to start navigating"
  4. // the URLs of your messages
  5. var messageurl=new Array()
  6. messageurl[0]=""
  7.  
  8. // the targets of the links
  9. // accepted values are '_blank' or '_top' or '_parent' or '_self'
  10. // or the name of your target-window (for instance 'main')
  11. var messagetarget=new Array()
  12. messagetarget[0]=""
  13.  
  14. // font-color
  15. var messagecolor= new Array()
  16. messagecolor[0]="white"
  17.  
  18. // distance of the scroller to the left margin of the browser-window (pixels)
  19. var scrollerleft=50
  20.  
  21. // distance of the scroller to the top margin of the browser-window (pixels)
  22. if (navigator.appName == "Netscape"){
  23. var scrollertop=200}
  24. else {var scrollertop=200} 
  25.  
  26. // width of the scroller (pixels)
  27. var scrollerwidth=650
  28.  
  29. // height of the scroller (pixels)
  30. var scrollerheight=20
  31.  
  32. // speed 1: lower means faster
  33. var pause=20
  34.  
  35. // speed 2: higher means faster
  36. var step=3
  37.  
  38. // font-size
  39. var fntsize=11
  40.  
  41.  
  42. // font-family
  43. var fntfamily="Arial"
  44.  
  45. // font-weight: 1 means bold, 0 means normal
  46. var fntweight=0
  47.  
  48. // do not edit the variables below
  49. var fadeimgwidth=60
  50. var fadeimgleftcontent,fadeimgrightcontent
  51. var clipleft,clipright,cliptop,clipbottom
  52. var i_message=0
  53. var timer
  54. var textwidth
  55. var textcontent=""
  56. if (fntweight==1) {fntweight="700"}
  57. else {fntweight="100"}
  58.  
  59. function init() {
  60.     gettextcontent()
  61.     
  62.     fadeimgleftcontent=""
  63.     fadeimgrightcontent=""
  64.  
  65.     if (document.all) {
  66.         text.innerHTML=textcontent
  67.         fadeimgleft.innerHTML=fadeimgleftcontent
  68.         fadeimgright.innerHTML=fadeimgrightcontent
  69.         textwidth=text.offsetWidth
  70.         document.all.text.style.posTop=scrollertop
  71.         document.all.text.style.posLeft=scrollerleft+scrollerwidth
  72.         document.all.fadeimgleft.style.posTop=scrollertop
  73.         document.all.fadeimgleft.style.posLeft=scrollerleft
  74.         document.all.fadeimgright.style.posTop=scrollertop
  75.         document.all.fadeimgright.style.posLeft=scrollerleft+scrollerwidth-fadeimgwidth
  76.  
  77.         clipleft=0
  78.         clipright=0
  79.         cliptop=0
  80.         clipbottom=scrollerheight
  81.         document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  82.         scrolltext()
  83.     }
  84.     if (document.layers) {
  85.         document.text.document.write(textcontent)
  86.         document.text.document.close()
  87.         document.fadeimgleft.document.write(fadeimgleftcontent)
  88.         document.fadeimgleft.document.close()
  89.         document.fadeimgright.document.write(fadeimgrightcontent)
  90.         document.fadeimgright.document.close()
  91.         textwidth=document.text.document.width
  92.         document.text.top=scrollertop
  93.         document.text.left=scrollerleft+scrollerwidth
  94.         document.fadeimgleft.top=scrollertop
  95.         document.fadeimgleft.left=scrollerleft
  96.         document.fadeimgright.top=scrollertop
  97.         document.fadeimgright.left=scrollerleft+scrollerwidth-fadeimgwidth
  98.         
  99.         document.text.clip.left=0
  100.         document.text.clip.right=0
  101.         document.text.clip.top=0
  102.         document.text.clip.bottom=scrollerheight
  103.  
  104.         scrolltext()
  105.     }
  106. }
  107.  
  108. function scrolltext() {
  109.     if (document.all) {
  110.         if (document.all.text.style.posLeft>=scrollerleft-textwidth) {
  111.     document.all.text.style.posLeft-=step
  112.     clipright+=step
  113.     if (clipright>scrollerwidth) {clipleft+=step}
  114.  
  115.     document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  116.             
  117.             var timer=setTimeout("scrolltext()",pause)
  118.         }
  119.         else {
  120.             changetext()
  121.         }
  122.     }
  123.    if (document.layers) {
  124.         if (document.text.left>=scrollerleft-textwidth) {
  125.             document.text.left-=step
  126.             document.text.clip.right+=step
  127.             if (document.text.clip.right>scrollerwidth) {
  128.                 document.text.clip.left+=step
  129.             }
  130.             var timer=setTimeout("scrolltext()",pause)
  131.         }
  132.         else {
  133.             changetext()
  134.         }
  135.     }
  136. }
  137.  
  138. function changetext() {
  139.     i_message++
  140.     if (i_message>message.length-1) {i_message=0}
  141.     gettextcontent()
  142.     if (document.all) {
  143.         text.innerHTML=textcontent
  144.         textwidth=text.offsetWidth
  145.         
  146.         document.all.text.style.posLeft=scrollerleft+scrollerwidth
  147.         clipleft=0
  148.         clipright=0
  149.         document.all.text.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")"
  150.         
  151.         scrolltext()
  152.     }
  153.  
  154.     if (document.layers) {
  155.            document.text.document.write(textcontent)
  156.         document.text.document.close()
  157.         textwidth=document.text.document.width
  158.  
  159.         document.text.left=scrollerleft+scrollerwidth
  160.         document.text.clip.left=0
  161.         document.text.clip.right=0
  162.         
  163.         scrolltext()
  164.     }
  165. }
  166.  
  167. function gettextcontent() {
  168.     textcontent="<span style='position:relative;font-size:"+fntsize+"pt;font-family:"+fntfamily+";font-weight:"+fntweight+"'>"
  169.     textcontent+="<nobr><font color="+messagecolor[i_message]+">"+message[i_message]+"</font></nobr></span>"
  170. }
  171.  
  172.