...

View Full Version : cross platform compatability



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



<head>
<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;
}
catch(e)
{
window.status = e.message;
}
}
</script>
</head>

<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">

dsirois1
12-30-2005, 08:49 PM
I found this but donít know how to implement it.
http://www.quirksmode.org/js/events_access.html

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.

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

“Error: doScroll is not defined”



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum