Results 1 to 2 of 2

Thread: TEXT SIZER script compatibility problem with frames

  1. #1
    Join Date
    Mar 2005
    Location
    kent, england
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default TEXT SIZER script compatibility problem with frames

    Hi, i need some help with the text sizer script - i need to modify the text of a iframe from the parent page using the script but it doesn't work! I've used target to specify the iframe (having named and id'ed it) and it doesn't work. I've modified the script and replaced document with document.frames['iframename'] but that doesn't work:
    Code:
    function ts( trgt,inc ) {
    	if (!document.frames['mainframe'].getElementById) return
    	var d = document.frames['mainframe'] , cEl = null,sz = startSz,i,j,cTags;
    	
    	sz += inc;
    	if ( sz < 0 ) sz = 0;
    	if ( sz > 6 ) sz = 6;
    	startSz = sz;
    		
    	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];
    
    	cEl.style.fontSize = szs[ sz ];
    
    	for ( i = 0 ; i < tgs.length ; i++ ) {
    		cTags = cEl.getElementsByTagName( tgs[ i ] );
    		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
    	}
    }

    I know i could use an alternative method to frames like layers and css or something but frames would be ideal for the site i'm developing (the problems inherent in frames would not adversely affect it). So if anyone can help, please do!

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Try:
    Code:
    	var d = document.frames['mainframe'].document , cEl = null,sz = startSz,i,j,cTags;
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

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
  •