View Full Version : cross platform compatability

12-30-2005, 08:08 PM
How do I make this script cross platform compatible? It works in IE but not FireFox

<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<script language=jscript>

function doScroll()
var curH = document.body.scrollTop;
window.status = "scrollTop = " + curH;
try {
myDiv.style.top = curH;
window.status = e.message;

<body onscroll="doScroll();">
<div id="myDiv" style="position:absolute;top:0px;right:5px;width:20%;height:100%;color:red;text-align:center;font-weight:bold">

12-30-2005, 08:49 PM
I found this but donít know how to implement it.

Cross-browser event accessing
Fortunately it is very easy to write a proper cross-browser script:
element.onclick = doSomething;

function doSomething(e)
if (!e) var e = window.event;
// e gives access to the event in all browsers
If the variable e does not exist (if it isnít sent to the function), make it a reference to window.event . Now e refers to the event in all browsers.

12-30-2005, 08:50 PM
Error message in javascript console says:

“Error: doScroll is not defined”