Something like this?
<script>
function init() {
divObj = document.all.menuDiv;
divObj.onmouseover = function() { vis(divObj); };
}
function vis(elem) {
alert(elem.id);
}
window.onload = init;
</script>
<div id="test"></div>
btw, replacing one line can also make this cross browser all the way back
to NS4.
Instead of:
divObj = document.all.menuDiv;
Use:
divObj = getObject('menuDiv');
which calls this function:
function getObject(nameStr) {
var ie = document.all? true : false;
var dom = document.getElementById && !document.all ? true : false;
var ns4 = document.layers ? true : false;
if (dom) { return document.getElementById(nameStr); }
if (ie) { return document.all[nameStr]; }
if (ns4) { return document.layers[nameStr]; }
}
--
jon
mailto:[EMAIL PROTECTED]
Thursday, December 26, 2002, 3:24:14 PM, you wrote:
TH> Hey,
TH> When I want to set a function for an event how do I pass it an object?
TH> EX:
TH> //alias document
TH> d = document;
TH> //get the div
TH> thisDiv = d.all.menuDiv;
TH> //give it the mouseover function
TH> thisDiv.onmouseover = changeVis;
TH> end ex
TH> Now I would assume there had to be a way to pass it an object. I would have
thought you could do = changeVis(thisDiv); or something but that just errors out.
TH> TIA
TH> Timothy Heald
TH> Assistant Webmaster
TH> Overseas Security Advisory Council
TH> U.S. Department of State
TH>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5