Log in

View Full Version : Fading Scroller Query



Southernwinds
11-14-2013, 08:12 PM
Fading scroller
http://www.dynamicdrive.com/dynamicindex2/fadescroll.htm

Just a quick question. I've been using the Fading Scroller for a while.
I can add a image to the scroller, I can make it linkable, but how do I get the link for the image to open up in a new window?
I've tried both target='_blank' and target='new' neither open in a new window. Does anyone know how or if this
is possible with this script?

Thanks - Southernwinds


<script type="text/javascript">

/***********************************************
* Fading Scroller- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var delay = 15000; //set delay between message change (in miliseconds)
var maxsteps=30; // number of steps to take to change from start color to endcolor
var stepdelay=40; // time in miliseconds of a single step
//**Note: maxsteps*stepdelay will be total time in miliseconds of fading effect
var startcolor= new Array(255,255,255); // start color (red, green, blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)
///Church Bullets Go Here/////////////////
var fcontent=new Array();
begintag='<div style="font: normal 14px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<b><font color='blue'>Memorial Service for Rev. Tom Adams</font><br><font color='purple'>Sunday November 17, 2013<br>Amite Baptist Church at 2:00 p.m.</font></b><br><hr><br>The family will receive guests at the church after the service. In lieu of flowers, Bro. Tom requests <font color='red'><b>donations to be made to Mission Dignity</b></font>.<br><br><a href='https://7538.thankyou4caring.org/page.aspx?pid=298'><img src='./clipart/donate.png' width='100' height='100' target='_blank'></a><br><font color='blue'><b><i>Click Our Heart to Donate</i></b></font>";
fcontent[1]="<b><font color='blue'>Ushers For The Week Of<br>November 17, 2013</font></b><br><hr><br><ul><li align='left'>Jeff Bennett</li><li align='left'>Greg Cowart</li><li align='left'>Bud Loper</li><li align='left'>Steve Webb</li><li align='left'>Ronnie McMorris</li><li align='left'>Garland Penton</li></ul><br><hr><b><font color='blue'>Deacon Of The Week For<br>November 17, 2013</font></b><ul><li align='left'>Jerry Woodward</li></ul>";
fcontent[2]="<b><font color='blue'>Nursery Schedule For The Week Of<br>November 17, 2013</font></b><br><hr><ul><li align='left'>A.M. Service: Babies<br>Judy Wilson & Melanie Honeycutt</li><br><li align='left'>A.M. Service: Preschool<br>Beth & Pete Galliano</li><br><li align='left'>P.M. Service:<br>Amy & Chris Nickel</li></ul><br><hr><b><font color='blue'>Wednesday, November 13, 2013</font></b><ul><li align='left'>Donnis Loper</li></ul>";
fcontent[3]="<b><font color='blue'>Church Security For<br>Wednesday, November 13, 2013</font></b><br><hr><br>David Marshall";
fcontent[4]="<b><font color='blue'>PERSPECTIVE: A storm the size Typhoon Haiyan would nearly cover the U.S.</font><br><a href='wxtyphoon.php'><font color='red'>LATEST NEWS FEED - CLICK HERE!</font></a><br><br><img src='./clipart/typhoonusa.jpg' width='300' height='260'>";
fcontent[5]="<b><font color='red'>WBC Website Special Bulletin</font></b><br><hr><b><font color='blue'>I have reconfigured the menu section, and added a few new areas.<br><br>But I need your help, in getting all the information corrected on the new pages.<br><br>Please send me any additions, omissions, corrections and information<br> to </font><a href='mailto:webmaster@watsonbaptist.com'>webmaster@watsonbaptist.com</a><br><br><font color='blue'>Thank You Very Much!</font>";
fcontent[6]="<b><font color='red'>WBC Website Special Bulletin</font></b><br><hr><b><font color='blue'>New Area has been added to the Media Center Section,</font> <font color='red'>The WBC Download Area</font>.<br><br>I have put all available Audio & Video files up for downloading.<br><br>All files are in ZIP Format. If you don't have WinZip it is also available for downloading.<br><br><b>Note: Some of the files are rather large, and will take some time to download from the site to your PC.</b><br><br>All Files should work with Windows Media Player.";
closetag='</div>';

var fwidth='320px'; //set scroller width
var fheight='340px'; //set scroller height

var fadelinks=1; //should links inside scroller content also fade like text? 0 for no, 1 for yes.

///No need to edit below this line/////////////////


var ie4=document.all&&!document.getElementById;
var DOM2=document.getElementById;
var faderdelay=0;
var index=0;


/*Rafael Raposo edited function*/
//function to change content
function changecontent(){
if (index>=fcontent.length)
index=0
if (DOM2){
document.getElementById("fscroller").style.color="rgb("+startcolor[0]+", "+startcolor[1]+", "+startcolor[2]+")"
document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
if (fadelinks)
linkcolorchange(1);
colorfade(1, 15);
}
else if (ie4)
document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag;
index++
}

// colorfade() partially by Marcio Galli for Netscape Communications. ////////////
// Modified by Dynamicdrive.com

function linkcolorchange(step){
var obj=document.getElementById("fscroller").getElementsByTagName("A");
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color=getstepcolor(step);
}
}

/*Rafael Raposo edited function*/
var fadecounter;
function colorfade(step) {
if(step<=maxsteps) {
document.getElementById("fscroller").style.color=getstepcolor(step);
if (fadelinks)
linkcolorchange(step);
step++;
fadecounter=setTimeout("colorfade("+step+")",stepdelay);
}else{
clearTimeout(fadecounter);
document.getElementById("fscroller").style.color="rgb("+endcolor[0]+", "+endcolor[1]+", "+endcolor[2]+")";
setTimeout("changecontent()", delay);

}
}

/*Rafael Raposo's new function*/
function getstepcolor(step) {
var diff
var newcolor=new Array(3);
for(var i=0;i<3;i++) {
diff = (startcolor[i]-endcolor[i]);
if(diff > 0) {
newcolor[i] = startcolor[i]-(Math.round((diff/maxsteps))*step);
} else {
newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/maxsteps))*step);
}
}
return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " + newcolor[2] + ")");
}

if (ie4||DOM2)
document.write('<div id="fscroller" style="border:1px solid black;width:'+fwidth+';height:'+fheight+'"></div>');

if (window.addEventListener)
window.addEventListener("load", changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", changecontent)
else if (document.getElementById)
window.onload=changecontent

</script>

jscheuer1
11-15-2013, 01:24 PM
In today's browsers, target='_blank' will almost always open a new tab. But it must be an attribute of the a tag. Here:


<a href='https://7538.thankyou4caring.org/page.aspx?pid=298'><img src='./clipart/donate.png' width='100' height='100' target='_blank'></a>

it's an attribute of the img tag. It should go here:


<a href='https://7538.thankyou4caring.org/page.aspx?pid=298' target='_blank'><img src='./clipart/donate.png' width='100' height='100'></a>

The browser cache may need to be cleared and/or the page refreshed to see changes.

Southernwinds
11-15-2013, 03:27 PM
Thanks, for the help, yes, that fixed it. You're a life saver Mr. John.
Thank you again!