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

Help - Cant fix for Netscape 6..

Status
Not open for further replies.

smurfer

Programmer
Jun 8, 2001
57
US
I have the following javascript code that displays a scrolling news bar at the top of my page, and it works fine for IE and for Netscapes pre v. 6. I am having problems adjusting it to work in N6, any help would be apprecaited.

JScript is:
<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!-- Begin

// change this to where you store the blank.gif image
var blank = &quot;/mkt/images/spacer.gif&quot;;

topedge = 138; // location of news box from top of page
leftedge = 16; // location of news box from left edge
boxheight = 32; // height of news box
boxwidth = 180; // width of news box
scrollheight = 1030; // total height of all data to be scrolled

function scrollnews(cliptop) {
//check for netscape pre v. 6
if (document.layers) {
newsDiv = document.news;
newsDiv.clip.top = cliptop;
newsDiv.clip.bottom = cliptop + boxheight;
newsDiv.clip.left = 0;
newsDiv.clip.right = boxwidth + leftedge;
newsDiv.left = leftedge;
newsDiv.top = topedge - cliptop;
}

//adding this to update for NN6...
else if (!document.all && document.getElementById){
//need to adjust values here for NN6..

}
//otherwise it is IE
else {
newsDiv = news.style;
newsDiv.clip = &quot;rect(&quot; + cliptop + &quot;px &quot; + (boxwidth + leftedge) + &quot;px &quot; + (cliptop + boxheight) + &quot;px 0px)&quot;;
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}

cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout(&quot;scrollnews(&quot; + cliptop + &quot;)&quot;, 150);
}
// End -->
</script>

body onload of course calls scrollnews(0) in the page

Here is the code for my div object

<div ID=&quot;news&quot; style=&quot;position:absolute; visibility:hidden; top:1; left:1; height:600; clip:rect(10,100,100,10); border-width:0px;&quot;>
<table border=0 cellpadding=1 cellspacing=0 bgcolor=&quot;white&quot;>
<tr>
<td><script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
<tr>
<td width=&quot;150&quot;>
<!-- Your scrolling text goes here -->
<FONT FACE=&quot;Verdana, Arial, Helvetica&quot; SIZE=&quot;1&quot;>
here are the items in<br>
scrolling list<br>
sample data of course<br>
</font></td>
</tr>
<tr>
<td><script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
</table>
</div>
</body>
</html>


Thank you!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top