SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Mar 2005
    Location
    Toronto
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using javascript to control frames

    My problem is that I need a solution to change the state of an image rollover sitting in frame A based on the content of frame B. For example, if frame B is about cars, then the button for cars in frame A should appear to be in its rollover state. I cannot use css for this and frames are a must for this as it is designed for Windows Mobile 5. Help would be greatly appreciated!

    PS: I tried to use parent.frameBname.document.title to do this, but everytime parent.frameBname.document.title would return me a value of '';

    Just in case if codes are needed, my current codes are:

    Code:
            function addImage (key) { 
    		document.getElementById(key).src = swapImage(key); 
    	} 
    	
    	function swapImage (key) { 
    		if (parent.content.document.title == key) { 
    			return 'images/button_' + key + 'over.gif'; 
    		} else { 
    			return 'images/button_' + key + '.gif'; 
    		} 
    	} 
    	
    	addImage('parts');
    In search of the clouds...and maybe some work

  2. #2
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    CSS is the best thing to use.

    http://www.echoecho.com/csslinks.htm

    The active pseudo-class (A:Active) allows you to set a style for a link that has been clicked. Normally this wouldn't be needed as the page will change and remove the click, but in a frames scenario, it will remain in the active state.

    So you can have an image for normal, an image for rollover and an image for clicked (or active).



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •