Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Need help with script conflict (Two scripts on one page)
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 22nd April 11:05
p wolpert
External User
 
Posts: 1
Default Need help with script conflict (Two scripts on one page)



This is my first post. I hope I don't sound stupid.
I have a script conflict when I put two scripts on one page. Both scripts
will work if I use one at a time but the menu button script will not work
when I add the scrolling text script. One script, the menu button script,
has an "Onload" command and the other one does not. From what I know, and
that's not much, I need to put both scripts in the "Onload" command. I just
don't know how to write the script for the scrolling text because it doesn't
use the "Onload" command. Here is the script I'm using. If anyone has a fix,
I thank you much.

Pat

IN THE HEAD.......

<title>Recipe 10.8</title>

<style id="main" type="text/css">

body {background-color:#eeeeee; font-family:Arial,Helvetica,sans-serif;
font-size:12px;}

h1 {font-size:2.0em; font-weight:bold}

</style>

<link rel="stylesheet" href="menus.css" type="text/css" />

<script language="JavaScript" type="text/javascript"
src="menus.js"></script>

IN THE BODY FOR THE MENU BUTTONS..........

<body onload="initMenus()">

<div id="menubar" align="left"><left>

<table border="0" width="100">

<tr>

<td>

<a href="index.html"><img id="menuImg_1" class="menuImg"

src="_images/home.gif" border="0" height="20"

width="125"></td>

</tr>

<tr>

<td><a href="heritage.html"><img id="menuImg_2"

class="menuImg" src="_images/heritage.gif" border="0" height="20"

width="125"></td></tr>

<tr>

<td><a href="ministries.html"><img id="menuImg_3"

class="menuImg" src="_images/ministries.gif" border="0"

height="20" width="125"></td></tr>

<tr>

<td><a href="missionaries.html"><img id="menuImg_4"

class="menuImg" src="_images/missionaries.gif" border="0"

height="20" width="125"></td></tr>

<tr>

<td><a href="calendar.html"><img id="menuImg_5"

class="menuImg" src="_images/calendar.gif" border="0"

height="20" width="125"></td></tr>

<tr>

<td><a href="feedback.html"><img id="menuImg_6"

class="menuImg" src="_images/feedback.gif" border="0"

height="20" width="125"></td></tr>

<tr>

<td><a href="contact.html"><img id="menuImg_7"

class="menuImg" src="_images/contact.gif" border="0"

height="20" width="125"></td></tr>

<tr>

<td><a href="Directory/directory.html"><img id="menuImg_8"

class="menuImg" src="_images/directory.gif" border="0"

height="20" width="125"></td></tr>

</table

</left>

</div>

IN THE BODY FOR THE SCROLLING TEXT..............

<script type="text/javascript">

/***********************************************

* Pausing updown message scroller- © Dynamic Drive DHTML code library
(http://www.dynamicdrive.com)

* This notice MUST stay intact for legal use

* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code

***********************************************/

//configure the below five variables to change the style of the scroller

var scrollerdelay='6000' //delay between msg scrolls. 3000=3 seconds.

var scrollerwidth='200px'

var scrollerheight='220px'

var scrollerbgcolor=''

//set below to '' if you don't wish to use a background image

var scrollerbackground="yes"

//configure the below variable to change the contents of the scroller

var messages=new Array()

messages[0]="<font face='Arial'><BR><BR><B>Welcome to Faith Calvary
Church</B></font>"

messages[1]="<font face='Arial'><B>Information in this area will be updated
often.</B></font>"

messages[2]="<font face='Arial'><B><BR>Come back often for more
information</B></font>"

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

var ie=do***ent.all

var dom=do***ent.getElementById

if (messages.length>2)

i=2

else

i=0

function move1(whichlayer){

tlayer=eval(whichlayer)

if (tlayer.top>0&&tlayer.top<=5){

tlayer.top=0

setTimeout("move1(tlayer)",scrollerdelay)

setTimeout("move2(do***ent.main.do***ent.second)", scrollerdelay)

return

}

if (tlayer.top>=tlayer.do***ent.height*-1){

tlayer.top-=5

setTimeout("move1(tlayer)",50)

}

else{

tlayer.top=parseInt(scrollerheight)

tlayer.do***ent.write(messages[i])

tlayer.do***ent.close()

if (i==messages.length-1)

i=0

else

i++

}

}

function move2(whichlayer){

tlayer2=eval(whichlayer)

if (tlayer2.top>0&&tlayer2.top<=5){

tlayer2.top=0

setTimeout("move2(tlayer2)",scrollerdelay)

setTimeout("move1(do***ent.main.do***ent.first)",s crollerdelay)

return

}

if (tlayer2.top>=tlayer2.do***ent.height*-1){

tlayer2.top-=5

setTimeout("move2(tlayer2)",50)

}

else{

tlayer2.top=parseInt(scrollerheight)

tlayer2.do***ent.write(messages[i])

tlayer2.do***ent.close()

if (i==messages.length-1)

i=0

else

i++

}

}

function move3(whichdiv){

tdiv=eval(whichdiv)

if (parseInt(tdiv.style.top)>0&&parseInt(tdiv.style.t op)<=5){

tdiv.style.top=0+"px"

setTimeout("move3(tdiv)",scrollerdelay)

setTimeout("move4(second2_obj)",scrollerdelay)

return

}

if (parseInt(tdiv.style.top)>=tdiv.offsetHeight*-1){

tdiv.style.top=parseInt(tdiv.style.top)-5+"px"

setTimeout("move3(tdiv)",50)

}

else{

tdiv.style.top=parseInt(scrollerheight)

tdiv.innerHTML=messages[i]

if (i==messages.length-1)

i=0

else

i++

}

}

function move4(whichdiv){

tdiv2=eval(whichdiv)

if (parseInt(tdiv2.style.top)>0&&parseInt(tdiv2.style .top)<=5){

tdiv2.style.top=0+"px"

setTimeout("move4(tdiv2)",scrollerdelay)

setTimeout("move3(first2_obj)",scrollerdelay)

return

}

if (parseInt(tdiv2.style.top)>=tdiv2.offsetHeight*-1){

tdiv2.style.top=parseInt(tdiv2.style.top)-5+"px"

setTimeout("move4(second2_obj)",50)

}

else{

tdiv2.style.top=parseInt(scrollerheight)

tdiv2.innerHTML=messages[i]

if (i==messages.length-1)

i=0

else

i++

}

}

function startscroll(){

if (ie||dom){

first2_obj=ie? first2 : do***ent.getElementById("first2")

second2_obj=ie? second2 : do***ent.getElementById("second2")

move3(first2_obj)

second2_obj.style.top=scrollerheight

second2_obj.style.visibility='visible'

}

else if (do***ent.layers){

do***ent.main.visibility='show'

move1(do***ent.main.do***ent.first)

do***ent.main.do***ent.second.top=parseInt(scrolle rheight)+5

do***ent.main.do***ent.second.visibility='show'

}

}

window.onload=startscroll

</script>

<ilayer id="main" width=&{scrollerwidth}; height=&{scrollerheight};
bgColor=&{scrollerbgcolor}; background=&{scrollerbackground};
visibility=hide>

<layer id="first" left=0 top=1 width=&{scrollerwidth};>

<script language="JavaScript1.2">

if (do***ent.layers)

do***ent.write(messages[0])

</script>

</layer>

<layer id="second" left=0 top=0 width=&{scrollerwidth}; visibility=hide>

<script language="JavaScript1.2">

if (do***ent.layers)

do***ent.write(messages[dyndetermine=(messages.length==1)? 0 : 1])

</script>

</layer>

</ilayer>

<script language="JavaScript1.2">

if (ie||dom){

do***ent.writeln('<div id="main2"
style="position:relative;width:'+scrollerwidth+';h eight:'+scrollerheight+';overflow:hidden;backgroun d-color:'+scrollerbgcolor+'
;background-image:url('+scrollerbackground+')">')

do***ent.writeln('<div
style="position:absolute;width:'+scrollerwidth+';h eight:'+scrollerheight+';clip:rect(0
'+scrollerwidth+' '+scrollerheight+' 0);left:0px;top:0px">')

do***ent.writeln('<div id="first2"
style="position:absolute;width:'+scrollerwidth+';l eft:0px;top:1px;">')

do***ent.write(messages[0])

do***ent.writeln('</div>')

do***ent.writeln('<div id="second2"
style="position:absolute;width:'+scrollerwidth+';l eft:0px;top:0px;visibility:hidden">')

do***ent.write(messages[dyndetermine=(messages.length==1)? 0 : 1])

do***ent.writeln('</div>')

do***ent.writeln('</div>')

do***ent.writeln('</div>')

}

</script>
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666