PDA

View Full Version : Running Two Javascripts on the same page



Marleyman
03-19-2013, 01:41 PM
I maintain a web page for our church. We currently have a javascript slideshow running on the page and I've been asked to add a scroller banner. I've got the code for both but when I add in the scroller banner javascipt code it doesn't work. Does anyone know how to fix this problem:mad:

vwphillips
03-19-2013, 05:20 PM
please post a link to your page and the scripts you are using

Marleyman
03-19-2013, 05:34 PM
http://www.rockinghamunited.org

vwphillips
03-20-2013, 09:32 AM
You have three body tags, there should only be one
and other HTML coding errors

I can see the Slide Show code but not the banner

please provide details of the banner

Marleyman
03-20-2013, 02:15 PM
The scroller I want to implement is from Javascriptkit. Here's the code:

<span id="highlighter" style="position:absolute;left:0;top:0;font-size:18px;font-family:Verdana;background-color:yellow;clip:rect(0px 0px auto 0px)"></span>
</div>

<script type="text/javascript">

/*
Highligher Scroller script- By JavaScript Kit
For this and over 400+ free scripts, visit http://www.javascriptkit.com/
This notice must stay intact
*/

var tickercontents=new Array()
tickercontents[0]='Looking for free Java applets and resources? Visit <a href="http://freewarejava.com">Freewarejava.com</a>!'
tickercontents[1]='Hop on over to <a href="http://www.codingforums.com">Coding Forums</a> to get help on web coding!'
tickercontents[2]='This scroller\'s brought to you by <a href="http://www.javascriptkit.com">JavaScript Kit</a>'

var tickdelay=3000 //delay btw messages
var highlightspeed=10 //10 pixels at a time.

////Do not edit pass this line////////////////

var currentmessage=0
var clipwidth=0

function changetickercontent(){
crosstick.style.clip="rect(0px 0px auto 0px)"
crosstick.innerHTML=tickercontents[currentmessage]
highlightmsg()
}

function highlightmsg(){
var msgwidth=crosstick.offsetWidth
if (clipwidth<msgwidth){
clipwidth+=highlightspeed
crosstick.style.clip="rect(0px "+clipwidth+"px auto 0px)"
beginclip=setTimeout("highlightmsg()",20)
}
else{
clipwidth=0
clearTimeout(beginclip)
if (currentmessage==tickercontents.length-1) currentmessage=0
else currentmessage++
setTimeout("changetickercontent()",tickdelay)
}
}

function start_ticking(){
crosstick=document.getElementById? document.getElementById("highlighter") : document.all.highlighter
crosstickParent=crosstick.parentNode? crosstick.parentNode : crosstick.parentElement
if (parseInt(crosstick.offsetHeight)>0)
crosstickParent.style.height=crosstick.offsetHeight+'px'
else
setTimeout("crosstickParent.style.height=crosstick.offsetHeight+'px'",100) //delay for Mozilla's sake
changetickercontent()
}

if (document.all || document.getElementById)
window.onload=start_ticking

</script>

<p align="left">This free script provided by<br />
<a href="http://javascriptkit.com">JavaScript Kit</a></p>

Once I have it installed and working I want to change the background color, reduce the speed and lenght of time each item shows, all of which I can do.

Marleyman
03-20-2013, 02:19 PM
I'm sorry, I also meant to post that I'll change the content of the scroller and that I want the scroller to appear just below the slideshow on the landing page..........