Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I create my own custom event? ie. onIframeSrcChange 1

Status
Not open for further replies.

werD420

Technical User
Sep 14, 2004
181
US
hello is it possible to create my own custom event? I have a treeview that i would like the location(selected index) updated if someone clicks a link inside of a page in an iframe. so i thought it best to check if the link is a member of the treeview by checking the src attribute when its changed. Is this possible if so could someone give me just a bit of direction on how to create the event/handler. i can handle it from there.

Thanks in advance


MCP, .Net Solutions Development <%_%>
 
If you want to attach something to the clicking of a link, you don't need to define a custom event - simply use the existing onclick event of the anchor:

Code:
<a href="something" onclick="someFunc(args...);">

If you don't want the anchor to be fired, you can add a return(false):

Code:
<a href="something" onclick="someFunc(args...); return(false);">

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
thanks im aware of this however, The pages in the iframe that im referring to are content pages they may be from anywhere in the company but some of these may reference files that are in the current projects toc but will just be linked to it. There is no way for me to enforce the javascript attributes on hrefs with these so this is why for the most part ill be handling this outside of the frame.
also i might want to react to this as well inside of the web app as some of the files may be linked to another project and i can use it to reference for help(although i can just grab the page src when the help button is clicked)/
My issue is that i would like to create something that monitors this src attribute of this content iframe for various purposes but i would especially like the event to fire when the src is changed the wrapping pages are all fully xhtml compliant so i thought maybe i could just treat it as xml but im not sure how i would monitor the attribute without firing an event or using a timer(which id like to avoid).

any other thoughts or suggestions?



MCP, .Net Solutions Development <%_%>
 
Excellent Idea. Thanks a lot

MCP, .Net Solutions Development <%_%>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top