Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Frontpage Newsgroups
Frontpage Programming
Java script timer and ticker conflicting
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Julia B, post: 3948256"] I've managed to get some code from DynamicDrive.com to create both a ticker and a count down timer on my web page. The problem is that although both work independently, when both of them are on the page only one will work (and that is the one lowest down on the page). I know very little about javascript but I reckon it's something to do with document.write - perhaps the last function overwrites the first one? Maybe completely wrong...... Anyone any ideas? Thanks in advance. Julia Code for the countdown can be found here [URL]http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm[/URL] Ticker code here: //Expandable ticker script- By Dynamic Drive //For full source code and more DHTML scripts, visit [URL]http://www.dynamicdrive.com[/URL] //This credit MUST stay intact for use //configure tickercontents[] to set the messges you wish be displayed (HTML codes accepted) var tickercontents=new Array() tickercontents[0]='<b>Current Status:</b> Currently there are no reported issues.</a>' tickercontents[1]='<b>Scheduled Downtime:</b> Currently there are no scheduled outages.</a>' tickercontents[2]='<b>News Update:</b> ECG comments form now working.</a>' //configure the below 2 variables to set the width/background color of the ticker var tickerwidth='100%' var tickerbgcolor='#DDDDFF' //configure the below variable to determine the delay between ticking of messages (in miliseconds) var tickdelay=4000 ////Do not edit pass this line//////////////// var ie4=document.all var ns6=document.getElementById var ns4=document.layers var currentmessage=0 var tickercontentstotal='' function changetickercontent(){ if (ns4){ tickerobj.document.tickernssub.document.write('<b><a href="#" onClick="return expandlist(event)">Expand</a></b> | '+tickercontents[currentmessage]) tickerobj.document.tickernssub.document.close() } else if (ie4||ns6){ tickerobj.innerHTML=tickercontents[currentmessage] previousmessage=(currentmessage==0)? tickercontents.length-1 : currentmessage-1 tickerexpand_item=ns6? document.getElementById("expand"+currentmessage) : eval("expand"+currentmessage) tickerexpand_previousitem=ns6? document.getElementById("expand"+previousmessage) : eval("expand"+previousmessage) tickerexpand_previousitem.className="" tickerexpand_item.className="expandhighlight" } currentmessage=(currentmessage==tickercontents.length-1)? 0 : currentmessage+1 setTimeout("changetickercontent()",tickdelay) } function start_ticking(){ if (ns4) document.tickernsmain.visibility="show" tickerobj=ie4? tickerlist : ns6? document.getElementById("tickerlist") : ns4? document.tickernsmain : "" tickerexpandobj=ie4? tickerexpand : ns6? document.getElementById("tickerexpand") : ns4? document.expandlayer : "" for (i=0;i<tickercontents.length;i++) //get total scroller contents tickercontentstotal+='<div id="expand'+i+'">- '+tickercontents[i]+'</div>' if (ie4||ns6) tickerexpandobj.innerHTML=tickercontentstotal else{ tickerexpandobj.document.write(tickercontentstotal) tickerexpandobj.document.close() } changetickercontent() } function expandlist(e){ if (ie4||ns6){ tickerexpand_parent=ie4? tickerexpand.parentElement : document.getElementById("tickerexpand").parentNode tickerexpand_parent.style.display=(tickerexpand_parent.style.display=="none")? "" : "none" } else{ document.expandlayer.left=e.pageX-e.layerX document.expandlayer.top= e.pageY-e.layerY+20 document.expandlayer.visibility=(document.expandlayer.visibility=="hide")? "show" : "hide" return false } } if (ie4||ns6) document.write('<table border="0" style="width:'+tickerwidth+';border:1px solid black;text-indent:2px" bgcolor="'+tickerbgcolor+'" cellspacing="0" cellpadding="0"><tr><td width="90%" id="tickerlist" bgcolor="'+tickerbgcolor+'"></td><td width="10%" bgcolor="'+tickerbgcolor+'"><div id="listbutton" onClick="expandlist()">Expand</div></td></tr><tr style="display:none"><td id="tickerexpand" width="90%" bgcolor="'+tickerbgcolor+'"> </td><td width="10%"></td></tr></table>') window.onload=start_ticking </script> <ilayer id="tickernsmain" width="&{tickerwidth};" bgColor="&{tickerbgcolor};" visibility="hide"> <layer id="tickernssub" width="&{tickerwidth};" left="0" top="0"></layer> </ilayer> </strong></td> </tr> </table> <p> <script language="JavaScript1.2"> //Dynamic countdown Script II- © Dynamic Drive ([URL="http://www.dynamicdrive.com"]www.dynamicdrive.com[/URL]) //Support for hour minutes and seconds added by Chuck Winrich (winrich@babson.edu) on 12-12-2001 //For full source code, 100's more DHTML scripts, visit [URL]http://www.dynamicdrive.com[/URL][/i] [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Frontpage Newsgroups
Frontpage Programming
Java script timer and ticker conflicting
Top