PDA

View Full Version : Extreme newbie having trouble with links on Fading Scroller



roadhag
09-14-2010, 07:32 PM
1) Script Title:
Fading Scroller

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex2/fadescroll.htm

3) Describe problem:
I have two active scrolls (?) each of which links to another page.... the first one (for Portland) works GREAT! The second one (for Chicago -- this will make sense when you see it), not so much... I've tried editing the link address about 4800 times and I can't seem to figure it out. Any help?

Here's the page where I'm having the trouble:

www.jojostein.com

Any help will be macho appreciated.

Cheers,
johanna


[CODE]
<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 = 2000; //set delay between message change (in miliseconds)
var maxsteps=50; // 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)

var fcontent=new Array();
begintag='<div style="font: normal 12px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<b>Upcoming Appearances: 9-22-10 Portland <i>'Back Porch PDX' storytelling show </i><a href='http://backfencepdx.com/'> Click for info</a>";
fcontent[1]="<b>Upcoming Appearances: 9-28-10 Chicago <i> 'FunnyHaHa' reading series/comedy show </i><a href='http://backfencepdx.com/'> Click for info</a>";
closetag='</div>';

var fwidth='600px'; //set scroller width
var fheight='28px'; //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>
[CODE]

azoomer
09-14-2010, 08:01 PM
This part will be where you need to edit the url highlighted in red


var fcontent=new Array();
begintag='<div style="font: normal 12px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<b>Upcoming Appearances: 9-22-10 Portland <i>'Back Porch PDX' storytelling show </i><a href='http://backfencepdx.com/'> Click for info</a>";
fcontent[1]="<b>Upcoming Appearances: 9-28-10 Chicago <i> 'FunnyHaHa' reading series/comedy show </i><a href='http://backfencepdx.com/'> Click for info</a>";
closetag='</div>';
(Scroll to the right to see it)

roadhag
09-15-2010, 04:34 AM
In my posting of the code I mistakenly posted one of the mannnny versions in which I tried pasting random addresses to make sure I could get something to work...

So here is the code that I want to work, but doesn't (I'm trying to link to the following web address: http://www.zulkey.com/funnyhaha.html)
but all I get is a "Not Found" message that pops up on my page and stays there...

[code]
<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 = 2000; //set delay between message change (in miliseconds)
var maxsteps=50; // 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)

var fcontent=new Array();
begintag='<div style="font: normal 12px Arial; padding: 5px;">'; //set opening tag, such as font declarations
fcontent[0]="<b>Upcoming Appearances: 9-22-10 Portland <i>'Back Porch PDX' storytelling show </i><a href='http://backfencepdx.com/'> Click for info</a>";
fcontent[1]="<b>Upcoming Appearances: 9-28-10 Chicago <i> 'FunnyHaHa' reading series/comedy show </i><a href='http://www.zulkey.com/funnyhaha.html/'> Click for info</a>";
closetag='</div>';

var fwidth='600px'; //set scroller width
var fheight='28px'; //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>

[code]

Thanks for any help you can offer!

azoomer
09-15-2010, 06:22 AM
did you try to take away the slash

<a href='http://www.zulkey.com/funnyhaha.html/'> Click for info</a>
like this

<a href='http://www.zulkey.com/funnyhaha.html'> Click for info</a>

roadhag
09-15-2010, 01:11 PM
I tried that... it still doesn't work -- you'll see if you give it a click...

www.jojostein.com

(click on the second scrolling item, "Chicago 'FunnyHaHa' reading series/comedy show")

Any other thoughts???