From: Dave W. <dw...@ck...> - 2000-11-09 02:40:54
|
I have a fade script working in IE 5 and Netscape 4.x but IE 4 does not work. if any one knows why this does not work in IE 4 I would be very grateful. I put the textarea in at the last as a debug helper. I dont think that it even runs my startItUp() function. Dave Waller the URL is http://www.ckhnet.com/users/dwaller/test/test.html here is the script: // Lines that begin with two slashes are documentation do not edit var fontSize = 2 // set to a downloadable font so that is most compatable var fontFace = "" // set to bold italic small large var fontStyle = "" // set to the upper left coner of the text box that you want var textXpos = 50 var textYpos = 50 // set to the sixe in pixels that you want the text box var textWidth = 650 var textHeight = 80 // set to the speed that you would like it to fade var fadeSpeed = 300 // set this it the back ground color var textBg = "white" // set this to be color that you want it to fade from var fadeStart = "000000" // set this to the color that you want the text to fade to var fadeEnd = "FFFFFF" // Do Not Change the next two lines var fadeText = new Array() var fadeHref = new Array() // edit text and links here // for a text without a link set the link to "NL" // you can have as many as you like fadeText[0] = "This is the first text This is the first text" fadeHref[0] = "blank1.html" fadeText[1] = "This is the second text This is the second text This is the second text This is the second text This is the second text" fadeHref[1] = "blank2.html" fadeText[2] = "This is a text sting with out a link" fadeHref[2] = "NL" fadeText[3] = "This is the third text" fadeHref[3] = "blank3.html" // end of editable variables // DO NOT EDIT BELOW THIS var hexBase= new Array("00", "33", "66", "99","AA", "CC", "FF") var r = 0 var g = 0 var b = 0 var x = 0 var l = 0 var t = 0 is.ns = (document.layers)? true:false is.ie = (document.all)? true:false var text = "" var linkText = "" if ( fadeStart < fadeEnd ){ var dir = 1 } else { var dir = -1 } for ( c = 0; c < 7; c++){ if ( fadeStart.substr(0,2) == hexBase[c] ){ var startR = c var r = c } if ( fadeStart.substr(2,2) == hexBase[c] ){ var startB = c var b = c } if ( fadeStart.substr(4,2) == hexBase[c] ){ var startG = c var g = c } if ( fadeEnd.substr(0,2) == hexBase[c] ){ var endR = c } if ( fadeEnd.substr(2,2) == hexBase[c] ){ var endB = c } if ( fadeEnd.substr(4,2) == hexBase[c] ){ var endG = c } } function nextFade(){ buildString() if ( fadeHref[t] != "NL" ){ var linkText = "<a href=\"" + fadeHref[t] + "\" target=\'_top\'><img src=\"pic.gif\" width=" + textWidth + " height=" + textHeight + "></a>" } else { var linkText = "<img src=\"pic.gif\" width=" + textWidth + " height=" + textHeight + ">" } if (is.ns){ textLayer.write(text) linkLayer.write(linkText) } else { document.all['textLayerDiv'].innerHTML = text document.all['linkLayerDiv'].innerHTML = linkText } //document.g.ta.value = text //alert(text) } function buildString(){ if ( dir > 0 ) { if ( r >= startR && g >= startG && b >= startB ){ if ( r < endR || b < endG || b < endB ){ if ( x == 0 ){ if ( g < endG ){ g++ } x++ } else if ( x == 1 ){ if ( b < endB ){ b++ } x++ } else { if ( r < endR ){ r++ } x = 0 } } else { g = startG b = startB r = startR x = 0 if ( t < (fadeText.length - 1 )){ t++ } else { t = 0 } } } } else { if ( r <= startR && g <= startG && b <= startB ){ if ( r > endR || g > endG || b > endB ){ if ( x == 0 ){ if ( g > endG ) { g-- } x = 2 } else if ( x == 1 ){ if ( b > endB ){ b-- } x-- } else { if ( r > endR ){ r-- } x-- } } else { g = startG b = startB r = startR x = 0 if ( t < ( fadeText.length - 1 )){ t++ } else { t = 0 } } } } var color = "color=\"#" + hexBase[r] + hexBase[b] + hexBase[g] text = "<table width=" + textWidth + "> <tr><td><font " + color + "\">" + fadeText[t] + "</font></td></tr></table>" } function startItUp(){ DynLayerInit() textLayer = new DynLayer("textLayerDiv") linkLayer = new DynLayer("linkLayerDiv") setInterval(nextFade,fadeSpeed) } |