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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant get this to work in netscape

Status
Not open for further replies.

maybe

Instructor
Jul 11, 2001
14
0
0
GB
PLease can someone help me.Why won't the anchors work in netscape 4X and it jumps in netscape 6, but it's OK in IE.


<html>
<head>
<title>Scroll</title>
<meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=iso-8859-1&quot;>
<style>
#divCont{position:absolute; width:350px; height:210px; overflow:hidden; top:190px; left:162px; clip:rect(0,350,210,0); visibility:hidden;z-index:1;}
#divText{position:absolute; top:100px; left:0px; z-index:1;}
</style>

<script language=&quot;JavaScript&quot;>

function isWin() {
if (navigator.appVersion.indexOf(&quot;Win&quot;) != -1) return true;
else return false;
}

function isPPC() {
if (navigator.appVersion.indexOf(&quot;PPC&quot;) != -1) return true;
else return false;
}

function checkBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf(&quot;MSIE 5&quot;)>-1 && this.dom)?1:0;
this.ie4=(document.all && !this.dom)?1:0;
this.ns5=(this.dom && parseInt(this.ver) >= 5) ?1:0;
this.ns4=(document.layers && !this.dom)?1:0;
this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5)
return this
}
bw=new checkBrowser()

//If you want it to move faster you can set this lower:
var speed=10

//Sets variables to keep track of what's happening
var loop, timer

//Object constructor
function makeObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.el=bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
this.css=bw.dom?document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+'document.'+obj):0;
this.scrollHeight=bw.ns4?this.css.document.height:this.el.offsetHeight
this.clipHeight=bw.ns4?this.css.clip.height:this.el.offsetHeight
this.up=goUp;this.down=goDown;
this.moveIt=moveIt; this.x; this.y;
this.obj = obj + &quot;Object&quot;
eval(this.obj + &quot;=this&quot;)
return this
}
function moveIt(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}

//Makes the object go up
function goDown(move){
if(this.y>-this.scrollHeight+oCont.clipHeight){
this.moveIt(0,this.y-move)
if(loop) setTimeout(this.obj+&quot;.down(&quot;+move+&quot;)&quot;,speed)
}
}
//Makes the object go down
function goUp(move){
if(this.y<0){
this.moveIt(0,this.y-move)
if(loop) setTimeout(this.obj+&quot;.up(&quot;+move+&quot;)&quot;,speed)
}
}

//Calls the scrolling functions. Also checks whether the page is loaded or not.
function scroll(speed){
if(loaded){
loop=true;
if(speed>0) oScroll.down(speed)
else oScroll.up(speed)
}
}

//Stops the scrolling (called on mouseout)
function noScroll(){
loop=false
if(timer) clearTimeout(timer)
}
//Makes the object
var loaded;
function scrollInit(){
oCont=new makeObj('divCont')
oScroll=new makeObj('divText','divCont')
oScroll.moveIt(0,0)
oCont.css.visibility='visible'
loaded=true;
}
//Call the init on page load
onload=scrollInit;



ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
verOK=(ns4||ie4)


//stick in the href to stop netscape jumping to the top
function nothing(){
}


//-->
</script>
</head>

<body bgcolor=&quot;#FFFFFF&quot; text=&quot;#000000&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot; rightmargin=&quot;0&quot;>
<div id=&quot;divCont&quot;>
<div id=&quot;divText&quot;>
<table border=&quot;0&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor1&quot;>Anchor 1</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.
</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor2&quot;>Anchor 2</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor3&quot;>Anchor 3</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor4&quot;>Anchor 4</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor5&quot;>Anchor 5</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor6&quot;>Anchor 6</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor7&quot;>Anchor 7</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor8&quot;>Anchor 8</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor9&quot;>Anchor 9</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>
This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor10&quot;>Anchor 10</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor11&quot;>Anchor 11</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor12&quot;>Anchor 12</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor13&quot;>Anchor 13</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.</td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;> 
</td>
</tr>
<tr>
<td class=&quot;whiteSubHeadings&quot;><a name=&quot;anchor14&quot;>Anchor 14</a></td>
</tr>
<tr>
<td class=&quot;blackLayerText&quot;>This is dummy copy it is not intended
to be read but is merely a simulation of text yet to be written.
This is dummy copy it is not intended to be read but is merely
a simulation of text yet to be written. This is dummy copy it
is not intended to be read but is merely a simulation of text
yet to be written. This is dummy copy it is not intended to
be read but is merely a simulation of text yet to be written.
</td>
</tr>
</table>
</div>
</div>


<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;100%&quot;>
<tr>
<td width=&quot;1%&quot;> </td>
<td width=&quot;99%&quot; align=&quot;center&quot; valign=&quot;middle&quot;>
<table width=&quot;709&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;396&quot;>
<tr>
<td width=&quot;709&quot; height=&quot;40&quot; colspan=&quot;3&quot; valign=&quot;top&quot;> </td>
</tr>
<tr>
<td height=&quot;316&quot; width=&quot;512&quot;>
<table width=&quot;512&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;315&quot; bgcolor=&quot;#99CCCC&quot;>
<tr>
<td>
<table width=&quot;512&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;316&quot;>
<tr>
<td height=&quot;35&quot; valign=&quot;top&quot; align=&quot;left&quot;><img src=&quot;images/tables/top_left.gif&quot; width=&quot;8&quot; height=&quot;8&quot;></td>
<td width=&quot;357&quot; height=&quot;35&quot; class=&quot;whiteMainHeadings&quot; valign=&quot;bottom&quot; colspan=&quot;2&quot;> </td>
<td height=&quot;315&quot; rowspan=&quot;5&quot; width=&quot;28&quot;> </td>
<td height=&quot;314&quot; rowspan=&quot;5&quot; width=&quot;117&quot;>
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot; height=&quot;316&quot;>
<tr>
<td height=&quot;277&quot;>
<a href=&quot;#anchor1&quot;>Anchor1</a><br>
<a href=&quot;#anchor2&quot;>Anchor2</a><br>
<a href=&quot;#anchor3&quot;>Anchor3</a><br>
<a href=&quot;#anchor4&quot;>Anchor4</a><br>
<a href=&quot;#anchor5&quot;>Anchor5</a><br>
<a href=&quot;#anchor6&quot;>Anchor6</a><br>
<a href=&quot;#anchor7&quot;>Anchor7</a><br>
<a href=&quot;#anchor8&quot;>Anchor8</a><br>
<a href=&quot;#anchor9&quot;>Anchor9</a><br>
<a href=&quot;#anchor10&quot;>Anchor10</a><br>
<a href=&quot;#anchor11&quot;>Anchor11</a><br>
<a href=&quot;#anchor12&quot;>Anchor12</a><br>
<a href=&quot;#anchor13&quot;>Anchor13</a><br>
<a href=&quot;#anchor14&quot;>Anchor14</a><br>
</td>
</tr>
<tr>
<td height=&quot;12&quot;> </td>
</tr>
<tr>
<td height=&quot;8&quot;> </td>
</tr>
</table>
</td>
<td height=&quot;158&quot; rowspan=&quot;4&quot; width=&quot;9&quot; valign=&quot;top&quot; align=&quot;right&quot;><img src=&quot;images/tables/top_right.gif&quot; width=&quot;8&quot; height=&quot;8&quot;></td>
</tr>
<tr>
<td height=&quot;10&quot; ><img src=&quot;images/shim.gif&quot; width=&quot;1&quot; height=&quot;10&quot;></td>
<td height=&quot;10&quot; width=&quot;357&quot; colspan=&quot;2&quot; ><img src=&quot;images/shim.gif&quot; width=&quot;1&quot; height=&quot;10&quot;></td>
</tr>
<tr>
<td rowspan=&quot;2&quot;> </td>
<td height=&quot;232&quot; width=&quot;357&quot; class=&quot;blackIntroText&quot; valign=&quot;top&quot; colspan=&quot;2&quot; > </td>
</tr>
<tr>
<td height=&quot;12&quot; width=&quot;109&quot;> <a href=&quot;#&quot; onMouseOver=&quot;scroll(-2);&quot; onMouseOut=&quot;noScroll();&quot;>
<img name=&quot;scroll_up_green&quot; src=&quot;images/scroll_images/green/scroll_up_green_off.gif&quot; width=&quot;60&quot; height=&quot;12&quot; border=&quot;0&quot;></a></td>
<td height=&quot;12&quot; width=&quot;248&quot;> <a href=&quot;#&quot; onMouseOver=&quot;scroll(2);&quot; onMouseOut=&quot;noScroll();&quot;>
<img name=&quot;scroll_down_green&quot; src=&quot;images/scroll_images/green/scroll_down_green_off.gif&quot; width=&quot;70&quot; height=&quot;12&quot; border=&quot;0&quot;></a></td>
</tr>
<tr>
<td height=&quot;8&quot; align=&quot;left&quot; valign=&quot;bottom&quot;><img src=&quot;images/tables/bottom_left.gif&quot; width=&quot;8&quot; height=&quot;7&quot;></td>
<td height=&quot;8&quot; width=&quot;357&quot; colspan=&quot;2&quot;> </td>
<td height=&quot;8&quot; width=&quot;9&quot; valign=&quot;bottom&quot; align=&quot;right&quot;><img src=&quot;images/tables/bottom_right.gif&quot; width=&quot;9&quot; height=&quot;8&quot;></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td height=&quot;316&quot; width=&quot;5&quot;> </td>
<td height=&quot;316&quot; width=&quot;190&quot;>  </td>
</tr>
<tr>
<td height=&quot;40&quot; colspan=&quot;3&quot; valign=&quot;bottom&quot; width=&quot;709&quot;> </td>
</tr>
</table>

</td>
</tr>
</table>
</body>
</html>
 
Hello,
This is one of the bugs in NS.
Sorry to say that, but the reality is such.
If your anchors were in simple hmtl, then no problems - you will be jumping without trouble.
But you have two nested div's and inside them table, and somewhere in table cell anchor. NS cannot handle such difficult hierarchy.
I would suggest a workaround of your problem:
use the function moveIt that you use mostly in scrolling.
<a href=&quot;javascript:eek:Scroll.moveIt(0,-1225)&quot;>Anchor9</a><br>
You have to calculate proper values for other anchors.
It will work both in IE and NS.
BUT: If you change the text inside copy texts you have to recalculate the distance again.

Success!
D.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top