I have used a script by David G. Miles to insert a scrollable area onto a webpage. Everything works perfectly when I test it on an IE browser. I can’t get it to work with other browsers like Netscape or Firefox – the area just displays what can fit, it won’t scroll down. Can someone please advise me what I need to do to make this compatible with other browsers? I’ve included the original script exactly as I got it below – this will display correctly in an IE browser. Thanks!
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “
<html xmlns=”
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>Untitled Document</title>
<style type=”text/css”>
#divUpControl {position:absolute; left:150px;top:318px; width:320px;height:30px; z-index:1; text-align: right}
#divDownControl {position:absolute; left:150px; top:495px; width:320px;height:30px; z-index:1;text-align: right}
#divContainer {LEFT: 150px; VISIBILITY: hidden; OVERFLOW: hidden; WIDTH:320px; CLIP: rect(0px 320px 150px 0px); POSITION: absolute; TOP: 340px; HEIGHT: 150px}
#divContent {LEFT: 0px; POSITION: absolute; TOP: 0px}
h1 { font: bold 12px Arial, Helvetica, sans-serif}
body { font: normal 12px Arial, Helvetica, sans-serif}
pscoll { font: normal 12px Arial, Helvetica, sans-serif }
–>
</style>
<script language=”JavaScript”>
/* Extension written by David G. Miles ([url]http://www.z3roadster.net/dreamweaver/
based in part on code written by Thomas Brattli ([url]
// Courtesy of SimplytheBest.net – [url]http://simplythebest.net/scripts/
<!–
function verifyCompatibleBrowser(){
this.ver=navigator.appVersion
this.dom=document.getElementById?1:0
this.ie5=(this.ver.indexOf(“MSIE 5”)>-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 verifyCompatibleBrowser()
var speed=50
var loop, timer
function ConstructObject(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=MoveAreaUp;this.down=MoveAreaDown;
this.MoveArea=MoveArea; this.x; this.y;
this.obj = obj + “Object”
eval(this.obj + “=this”)
return this
}
function MoveArea(x,y){
this.x=x;this.y=y
this.css.left=this.x
this.css.top=this.y
}
function MoveAreaDown(move){
if(this.y>-this.scrollHeight+objContainer.clipHeight){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+”.down(“+move+”)”,speed)
}
}
function MoveAreaUp(move){
if(this.y<0){
this.MoveArea(0,this.y-move)
if(loop) setTimeout(this.obj+”.up(“+move+”)”,speed)
}
}
function PerformScroll(speed){
if(initialised){
loop=true;
if(speed>0) objScroller.down(speed)
else objScroller.up(speed)
}
}
function CeaseScroll(){
loop=false
if(timer) clearTimeout(timer)
}
var initialised;
function InitialiseScrollableArea(){
objContainer=new ConstructObject(‘divContainer’)
objScroller=new ConstructObject(‘divContent’,’divContainer’)
objScroller.MoveArea(0,0)
objContainer.css.visibility=’visible’
initialised=true;
}
function displayStatusMsg(msgStr) {
status=msgStr;
document.returnValue = true;
}
function preloadImages() {
var d=document; if(d.images){ if(!d.p) d.p=new Array();
var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function swapImgRestore() {
var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}
function swapImage() {
var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//–>
</script>
<script language=”JavaScript”>
<!–
function reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==”Netscape”)&&(parseInt(appVersion)==4)) {
document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
// –>
</script>
</head>
<body onLoad=”InitialiseScrollableArea();preloadImages(‘images/scroller_up_on.gif’,’images/scroller_down_on.gif’)”>
Hello
<!– begin scrollable area object –>
<div id=”divUpControl”> <a href=”javascript:;” onMouseOver=”PerformScroll(-7);displayStatusMsg(‘Scroll Up’);swapImage(‘scroller_up_button’,”,’images/scroller_up_on.gif’,1);return document.returnValue” onMouseOut=”CeaseScroll();swapImgRestore()”><img name=”scroller_up_button” src=”images/scroller_up.gif” border=”0″ alt=”Up”></a></div>
<div id=”divDownControl”> <a href=”javascript:;” onMouseOver=”PerformScroll(7);displayStatusMsg(‘Scroll Down’);swapImage(‘scroller_down_button’,”,’images/scroller_down_on.gif’,1);return document.returnValue” onMouseOut=”CeaseScroll();swapImgRestore()”><img name=”scroller_down_button” src=”images/scroller_down.gif” border=”0″ alt=”Down”></a></div>
<div id=”divContainer”>
<div id=”divContent”> <b>SimplytheBest.net</b>
<p class=”pscoll”>
<img src=”
the SimplytheBest <a href=”
and <a href=”
page</a> you can find all the latest additions, while on the <a href=”
page</a> you’ll find the Hot Picks of this moment.</p>
<p class=”pscoll”>
<img src=”
explanations on many Internet related subjects such as <a href=”
<a href=”
resources</a>, selected links to related resources such as <a href=”
<a href=”
how-to pages such as <a href=”
<a href=”
<p class=”pscoll”>
<img src=”
<a href=”
artists, manufacturers, record labels, studios, music sites and most industry
related sites. <a href=”
a studio or <a href=”
your own listing and you just may be ‘discovered’.</p>
<p class=”pscoll”>
At SimplytheBest.net you’ll find also the Affiliate Programs directory, DHTML scripts and JavaScripts, the
Hosting directory and more.<br>
</p>
</div>
</div>
<!– end scrollable area object –>
</body>
</html>