Link to home
Start Free TrialLog in
Avatar of krewson
krewson

asked on

Change image based on template loaded in other frame

I have two frames, one is called "navigation" and the other is called "main". I want to change the image that the user clicks in the navigation frame when that page is loaded into the main frame.  Can this be done in ColdFusion or do I need to work this our with JavaScript?
Avatar of bigbadb
bigbadb

You should use javascript.  This will probably an onclick event so it will be client side.  CF is all server side and cannot handle image swapping


If you are a little more specific about  your needs and post some code I may be able to help out more
Avatar of krewson

ASKER

I'm not looking to image swap.  This is what I'm looking for in the navigation frame:

<a href="events.cfm" target="main">
<cfif --page in main frame-- eq "events.cfm">
<img src="events.gif">
<cfelse>
<img src="eventsselected.gif">
</cfif>
</a>

so that a different image is loaded for the button that the user is viewing in the other frame.  I just don't know how to refer to the .cfm page in the cfif.



ASKER CERTIFIED SOLUTION
Avatar of Nathan Stanford Sr
Nathan Stanford Sr
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in your frame window you can do a window.src == 'events.cfm' then set your img.src to be either events.gif or eventsselected.gif.  I think javascript is the best way to do this.  There is also a frame property in javascript you might be able to use
nathans is right you should reload te both pages I think you use the javscript for that purposeit is suitable for you
Avatar of krewson

ASKER

Reloading both pages works.
Thanks if you need help with the javascript to load reload both pages let me know.