Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

almost identical scripts wont work on one page, will on another

Status
Not open for further replies.

theEclipse

Programmer
Dec 27, 1999
1,190
US
OK OK OK.<br>
Here's the deal:<br>
<br>
I have scripts that I will post at my website for people to use on their site. kind of a library type of thing. I have written the scripts, and they work fine. I also personally use the scripts on my pages (makes sense). and here is the problem. The script works fine on page A, but not page B.<br>
they both refrence to the same .js file. Here are the pages, and the .js file. I have clipped alot of the text on the pages, but the page is in tact. the pages are part of the frameset. To see the script working, goto: <A HREF=" TARGET="_new"><br>
<br>
.js file:<br>
-------------------------------------------------<br>
var lastLyr;<br>
var time;<br>
net=(document.layers)?1:0;<br>
hidden =(net)?'hide':'hidden';<br>
visible =(net)?'show':'visible';<br>
pre = (net)?'document.layers.':'document.all.';<br>
suf = (net)?'':'.style';<br>
<br>
function changeImg(img,newSrc){<br>
alert(img+' '+newSrc)<br>
theImg =eva('document.'+img);<br>
theImg.src = newSrc;}<br>
<br>
function changeLyr(div){<br>
theDiv = eval(pre+div+suf);<br>
lastLyr.visibility = hidden;<br>
theDiv.visibility = visible;<br>
lastLyr = theDiv;}<br>
<br>
function moveLyrUp(){<br>
lastLyr.top = parseInt(lastLyr.top) - 5;<br>
time = setTimeout('moveLyrUp()',50);}<br>
<br>
function moveLyrDown(){alert('down')<br>
lastLyr.top = parseInt(lastLyr.top) + 5;<br>
time = setTimeout('moveLyrDown()',50);<br>
alert('edown')}<br>
<br>
function cancelLyrMove(){clearTimeout(time);}<br>
<br>
-------------------------------------------------------<br>
<br>
page A:<br>
<br>
---------------------------------------------------------<br>
<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;title&gt;If you can see this, goto: robacarp.webjump.com&lt;/title&gt;<br>
<br>
&lt;script language=&quot;javascript&quot; src=&quot;scripts/framesetScripts.js&quot;&gt;&lt;/script&gt;<br>
&lt;script language=&quot;javascript&quot;&gt;<br>
function startIt(){lastLyr = eval(pre+'newUser'+suf);}<br>
&lt;/script&gt;<br>
<br>
<br>
&lt;style&gt;<br>
a{text-decoration:none; color:#C0C0C0}<br>
a:active{text-decoration:none; color#C0C0C0}<br>
a:visited{text-decoration:none; color#C0C0C0}<br>
a:hover{text-decoration:underline; color:#A9B7DC}<br>
.pages {left:10; width:300;}<br>
#container {width:310; height:400; position:absolute; top:10; left:330; border:solid 2px black; overflow:hidden;}<br>
#scroller {position:absolute; top:50; left:305; backgruond-color:#FFFFFF; layer-background-color:#FFFFFF; border:#000000;}<br>
&lt;/style&gt;&lt;/head&gt;<br>
<br>
<br>
&lt;body onload=&quot;startIt();&quot;&gt;<br>
<br>
&lt;!--this is where the page content normally goes--&gt;<br>
<br>
&lt;div id=&quot;scroller&quot;&gt;&lt;!--this is the page scroller--&gt;<br>
&lt;!--the up arrow--&gt;<br>
&lt;a href=&quot;#&quot; onMouseOver=&quot;changeImg('thearwup','images/darkArrowUp.gif'); cancelLyrMove(); moveLyrDown();&quot; onMouseOut=&quot;changeImg('thearwup','images/lightArrowUp.gif');cancelLyrMove()&quot;&gt;<br>
&lt;img src=&quot;images/lightArrowUp.gif&quot; name=thearwup border=0&gt;&lt;/a&gt;&lt;br&gt;<br>
<br>
&lt;!--the top text--&gt;<br>
<br>
&lt;a href=&quot;#&quot; onClick=&quot;lastLyr.top = 0; return false;&quot;&gt;top&lt;/a&gt;&lt;br&gt;<br>
<br>
&lt;!--the down arrow--&gt;<br>
<br>
&lt;a href=&quot;#&quot; onClick=&quot;return false;&quot; onMouseOver=&quot;changeImg('thearwdown','images/darkArrowDown.gif'); cancelLyrMove(); moveLyrUp();&quot; onMouseOut=&quot;changeImg('thearwdown','images/lightArrowDown.gif');cancelLyrMove();&quot;&gt;<br>
&lt;img src=&quot;images/lightArrowDown.gif&quot; name=thearwdown border=0&gt;&lt;/a&gt;<br>
&lt;/div&gt;<br>
<br>
&lt;!--the end of the scroller--&gt;<br>
<br>
<br>
&lt;!--this is the container layer--&gt;<br>
&lt;div id=container&gt;<br>
<br>
&lt;div id=news class=pages style=&quot;visibility:hidden; position:absolute; top:0;&quot;&gt;<br>
<br>
&lt;!--this is the news page--&gt;<br>
<br>
&lt;/div&gt;<br>
<br>
&lt;div id=&quot;newUser&quot; class=pages style=&quot;visibility:visible; position:absolute; top:0;&quot;&gt;<br>
<br>
&lt;!--this is the newUser page--&gt;<br>
<br>
&lt;/div&gt;<br>
&lt;div align=left id=thanksTo class=pages style=&quot;visibility:hidden; position:absolute; top:0;&quot;&gt;<br>
<br>
&lt;!--this is the thanksTo div--&gt;<br>
&lt;!--in here goes the name/url of he/she whome helps me--&gt;<br>
<br>
&lt;/div&gt;<br>
&lt;/div&gt;<br>
&lt;!--the end of the container layer--&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
<br>
---------------------------------------------------<br>
<br>
page B<br>
<br>
---------------------------------------------------<br>
<br>
&lt;html&gt;<br>
&lt;head&gt;<br>
&lt;title&gt;If you can see this, goto: robacarp.webjump.com&lt;/title&gt;<br>
<br>
<br>
&lt;script language=&quot;javascript&quot; src=&quot;scripts/framesetScripts.js&quot;&gt;&lt;/script&gt;<br>
&lt;script language=&quot;javascript&quot;&gt;<br>
function startIt(){<br>
lastLyr = eval(pre+'theMenu'+suf);}<br>
&lt;/script&gt;<br>
<br>
<br>
&lt;style&gt;<br>
#menu{position:absolute; top:150 width:90%; z-index:3;}<br>
#scrollers{position:absolute; top:0; left:0; z-index:4; width:10%; background-color:#ffffff; layer-background-color:#ffffff;}<br>
a{text-decoration:none; color:#C0C0C0}<br>
a:active{text-decoration:none; color#C0C0C0}<br>
a:visited{text-decoration:none; color#C0C0C0}<br>
a:hover{text-decoration:underline; color:#A9B7DC}<br>
&lt;/style&gt;&lt;/head&gt;<br>
<br>
<br>
&lt;body onload=startIt()&gt;<br>
<br>
&lt;!--there is no container layer, since this is the only scrollable layer on the page, and it is in frames--&gt;<br>
<br>
&lt;div id=theMenu&gt;&lt;!--this is where the scrollable page is--&gt;&lt;/div&gt;<br>
<br>
&lt;!--this is the page scroller--&gt;<br>
<br>
&lt;div id=&quot;scroller&quot;&gt;<br>
<br>
&lt;!--the up arrow--&gt;<br>
&lt;a href=&quot;#&quot; onMouseOver=&quot;changeImg('thearwup','images/darkArrowUp.gif'); cancelLyrMove(); moveLyrDown();&quot; onMouseOut=&quot;changeImg('thearwup','images/lightArrowUp.gif');cancelLyrMove()&quot;&gt;<br>
&lt;img src=&quot;images/lightArrowUp.gif&quot; name=thearwup border=0&gt;&lt;/a&gt;&lt;br&gt;<br>
<br>
&lt;!--the top text--&gt;<br>
<br>
&lt;a href=&quot;#&quot; onClick=&quot;lastLyr.top = 0; return false;&quot;&gt;top&lt;/a&gt;&lt;br&gt;<br>
<br>
&lt;!--the down arrow--&gt;<br>
<br>
&lt;a href=&quot;#&quot; onClick=&quot;return false;&quot; onMouseOver=&quot;changeImg('thearwdown','images/darkArrowDown.gif'); cancelLyrMove(); moveLyrUp();&quot; onMouseOut=&quot;changeImg('thearwdown','images/lightArrowDown.gif');cancelLyrMove();&quot;&gt;<br>
&lt;img src=&quot;images/lightArrowDown.gif&quot; name=thearwdown border=0&gt;&lt;/a&gt;<br>
&lt;/div&gt;<br>
&lt;!--the end of the scroller --&gt;<br>
&lt;?html&gt;<br>
&lt;/body&gt;<br>
&lt;/html&gt;<br>
<br>
Thanks alot.<br>
theEclipse<br>
robacarp.webjump.com<br>
<br>
<br>
P.S.:I not so much want to know how to fix it, but why, otherwise I can't remember not to do it again!!<br>
<br>
but anything is helpfull :)<br>
<br>
<br>
<br>
<br>
<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top