Tim;

Sure, you can pass objects into expressions in javascript.

I am not sure what the code in changeVis looks like, but I will bet your
problem lies there.

Also, remember that objects do not have a default visibility property
associated with their style in IE. That is, while they are visible by
default, the property of visibility does not exist until specified through
the code. Could this be part of the error?

Try this and let me know how it works for you.

M

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
        <title>JS Example</title>
        <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
    <!--
        function change_me(arg1){
                        d = document;
                        c = d.all[arg1];
                        if(c.style.visibility == 'hidden'){
                                c.style.visibility = 'visible';
                        } else {
                                c.style.visibility = 'hidden';
                        }
                }
    //-->
    </SCRIPT>
</head>
<body>
<div style="width:150px; height:150px; background:blue; visibility:hidden;"
id="box">
Hello I am the DIV tag.
</div>
<form>
        <input type="button" name="btn_1" value="Click Me!"
onclick="change_me('box');">
</form>
</body>
</html>


-----Original Message-----
From: Timothy Heald [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, December 26, 2002 3:24 PM
To: CF-Community
Subject: JS Question


Hey,
        When I want to set a function for an event how do I pass it an
object?

EX:
        //alias document
        d = document;

        //get the div
        thisDiv = d.all.menuDiv;

        //give it the mouseover function
        thisDiv.onmouseover = changeVis;

end ex

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.

TIA
        

Timothy Heald
Assistant Webmaster
Overseas Security Advisory Council
U.S. Department of State 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Get the mailserver that powers this list at http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5

Reply via email to