C
Csaba2000
I thought assigning one function to another was fairly straightforward,
as the example below illustrates. So I was really surprised that IE 6
showed the alert while Firefox 1.0.1 failed.
It's easy to shore up Firefox by changing the elem=... line, below, to:
var elem = function (myId) {return document.getElementById(myId);}
Could any of the theory gurus shed some light on this discrepancy?
<body id=myBody onLoad="tryit()">
<script type='text/javascript'>
var elem = document.getElementById; // just say no to long function
names
function tryit() { alert (elem('myBody').id); }
</script></body>
Csaba Gabor from New York
as the example below illustrates. So I was really surprised that IE 6
showed the alert while Firefox 1.0.1 failed.
It's easy to shore up Firefox by changing the elem=... line, below, to:
var elem = function (myId) {return document.getElementById(myId);}
Could any of the theory gurus shed some light on this discrepancy?
<body id=myBody onLoad="tryit()">
<script type='text/javascript'>
var elem = document.getElementById; // just say no to long function
names
function tryit() { alert (elem('myBody').id); }
</script></body>
Csaba Gabor from New York