Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Onclick In Layers

Recommended Posts

I'm trying to get a layer (in Netscape...) to respond to mouse clicks. Currently the text in the layer is a link and what I would like is for another layer to pop up when the link is clicked on (defining the word in the link) The problem is that I can't name each individual layer and use absolute references (there are a too many definitions) so I need to backtrace from the link to the layer it's in. I have no clue how to do this--I can acess the document of the bottom layer but I don't know how to get to the layer above (document.layers.parentLayer does not work)Any ideas?

Share this post


Link to post
Share on other sites

Are you using javascript in href to call a function or javascript to show a layer? If yes, when calling the javascript code or javascript function, you can pass the current object (the layer that contains the link) to the function.

 

For example,

<script type="text/javascript">

function abc(currentObject){

// now you can get the layer without using id

}

</script>

 

<a href="#" onclick="abc(this)">link</a>

 

Using this method, you can let the function access the current layer without asigning any id to it.

 

Hope that it is useful to you.

 

I'm trying to get a layer (in Netscape...) to respond to mouse clicks. Currently the text in the layer is a link and what I would like is for another layer to pop up when the link is clicked on (defining the word in the link) The problem is that I can't name each individual layer and use absolute references (there are a too many definitions) so I need to backtrace from the link to the layer it's in. I have no clue how to do this--I can acess the document of the bottom layer but I don't know how to get to the layer above (document.layers.parentLayer does not work)

Any ideas?

210349[/snapback]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.