home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1999 November / PCOnline_11_1999.iso / home / fader.js next >
Text File  |  1998-11-11  |  3KB  |  123 lines

  1. NS4 = (document.layers) ? 1 : 0;
  2. IE4 = (document.all) ? 1 : 0;
  3.  
  4. semi = ";";
  5. sp = " ";
  6.  
  7. styleStr = "<STYLE TYPE='text\/css'>"
  8.  + "#elAll {"
  9.  + "position:relative;"
  10.  + "width:" + boxWid + semi
  11.  + "height:" + boxHgt + semi
  12.  + "background-color:" + backCol + semi
  13.  + "layer-background-color:" + backCol + semi
  14.  + "clip:rect(0 "+ boxWid + sp + boxHgt + " 0)" + semi
  15.  + "}"
  16.  + "#elNews {"
  17.  + "position:absolute;"
  18.  + "height:" + boxHgt + semi
  19.  + "background-color:" + backCol + semi
  20.  + "layer-background-color:" + backCol + semi
  21.  + "clip:rect(0 "+ boxWid + sp + boxHgt + " 0)" + semi
  22.  + "}"
  23.  + "#elGif {position:absolute}"
  24.  + "#elNoDHTML {position:absolute; visibility:hidden}"
  25.  + "A.newslink {"
  26.  + "text-decoration:"+ txtDec + semi
  27.  + "text-align:"+ txtAln + semi
  28.  + "color:"+ HLfntCol + semi
  29.  + "font-size:"+ fntSiz + semi
  30.  + "font-weight:"+ fntWgh + semi
  31.  + "font-style:"+ fntSty + semi
  32.  + "font-family:"+ fntFam + semi
  33.  + "line-height:"+ linHgt + semi
  34.  + "}"
  35.  + "A.newslink:hover {"
  36.  + "color:"+ HLhovCol + semi
  37.  + "}"
  38.  + "P.newsTXT {"
  39.  + "text-align:"+ txtAln + semi
  40.  + "color:"+ fntCol + semi
  41.  + "font-size:"+ fntSiz + semi
  42.  + "font-weight:"+ fntWgh + semi
  43.  + "font-style:"+ fntSty + semi
  44.  + "font-family:"+ fntFam + semi
  45.  + "line-height:"+ linHgt + semi
  46.  + "}"
  47.  + "<\/STYLE>";
  48.  
  49. document.write(styleStr);
  50.  
  51. finite = (maxLoops > 0) ? 1 : 0;
  52. slideInt = (blendDur/(boxHgt/slideInc))*1000;
  53.  
  54. arNews = new Array();
  55. for (i=0; i<arURL.length; i++) {
  56.     arNews[i] = new Array(3);
  57.     arNews[i][0] = prefix + arURL[i];
  58.     arNews[i][1] = arHL[i];
  59.     arNews[i][2] = arTXT[i];
  60. }
  61.  
  62. window.onload = initIt;
  63.  
  64. function initIt(){
  65.     if (NS4) {
  66.         if (!document.elAll) return;
  67.         elAll = document.elAll;
  68.         elNews = elAll.document.elNews;
  69.         elGif = elAll.document.elGif;
  70.         imStr = "<IMG SRC='fade.gif' HEIGHT="+boxHgt+" WIDTH="+boxWid+">"
  71.         elGif.document.write(imStr);
  72.         elGif.document.close();
  73.     }
  74.     else {
  75.         elNews.style.filter = "blendTrans(duration=" + blendDur + ")";
  76.     }
  77.  
  78.     newsCount = 0;
  79.     if (finite) loopCount = 0;
  80.     doIt();
  81.     blendTimer = setInterval("doIt()",blendInt*1000)
  82. }
  83.  
  84. function doIt() {
  85.     if (finite && loopCount==maxLoops) {
  86.         clearInterval(blendTimer);
  87.         return;
  88.     }
  89.     if (NS4) elGif.top = 0;
  90.  
  91.     newsStr = "<A CLASS=newslink "
  92.               + "HREF=" + arNews[newsCount][0] + ">"
  93.               + arNews[newsCount][1] +
  94.               "<p class=newsTXT>" + arNews[newsCount][2] + "</p></A>"
  95.  
  96.  
  97.     if (NS4) {
  98.         with (elNews.document) {
  99.             write(newsStr);
  100.             close();
  101.         }
  102.     }
  103.     else {
  104.         elNews.filters.blendTrans.Apply();
  105.         elNews.innerHTML = newsStr;
  106.         elNews.filters.blendTrans.Play();
  107.     }
  108.  
  109.     newsCount++;
  110.     if (newsCount == arNews.length) {
  111.         newsCount=0;
  112.         if (finite) loopCount++;
  113.     }
  114.  
  115.     if (NS4) slideIt();
  116. }
  117.  
  118. function slideIt(){
  119.     elGif.top += slideInc;
  120.     if (elGif.top >= boxHgt) return;
  121.     setTimeout("slideIt()",slideInt);
  122. }
  123.