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="JavaScript" type="text/javascript">
<!-- Begin
// change this to where you store the blank.gif image
var blank = "/mkt/images/spacer.gif";
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 = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + "", 150);
}
// End -->
</script>
body onload of course calls scrollnews(0) in the page
Here is the code for my div object
<div ID="news" style="position:absolute; visibility:hidden; top:1; left:1; height:600; clip:rect(10,100,100,10); border-width:0px;">
<table border=0 cellpadding=1 cellspacing=0 bgcolor="white">
<tr>
<td><script language="javascript" type="text/javascript">document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
<tr>
<td width="150">
<!-- Your scrolling text goes here -->
<FONT FACE="Verdana, Arial, Helvetica" SIZE="1">
here are the items in<br>
scrolling list<br>
sample data of course<br>
</font></td>
</tr>
<tr>
<td><script language="javascript" type="text/javascript">document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
</table>
</div>
</body>
</html>
Thank you!!!
JScript is:
<script language="JavaScript" type="text/javascript">
<!-- Begin
// change this to where you store the blank.gif image
var blank = "/mkt/images/spacer.gif";
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 = "rect(" + cliptop + "px " + (boxwidth + leftedge) + "px " + (cliptop + boxheight) + "px 0px)";
newsDiv.pixelLeft = leftedge;
newsDiv.pixelTop = topedge - cliptop;
}
cliptop = (cliptop + 1) % (scrollheight + boxheight);
newsDiv.visibility='visible';
setTimeout("scrollnews(" + cliptop + "", 150);
}
// End -->
</script>
body onload of course calls scrollnews(0) in the page
Here is the code for my div object
<div ID="news" style="position:absolute; visibility:hidden; top:1; left:1; height:600; clip:rect(10,100,100,10); border-width:0px;">
<table border=0 cellpadding=1 cellspacing=0 bgcolor="white">
<tr>
<td><script language="javascript" type="text/javascript">document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
<tr>
<td width="150">
<!-- Your scrolling text goes here -->
<FONT FACE="Verdana, Arial, Helvetica" SIZE="1">
here are the items in<br>
scrolling list<br>
sample data of course<br>
</font></td>
</tr>
<tr>
<td><script language="javascript" type="text/javascript">document.write('<img src=' + blank + ' width=1 height='+boxheight+'>'); </script></td>
</tr>
</table>
</div>
</body>
</html>
Thank you!!!