PDA

View Full Version : TEXT SIZER script compatibility problem with frames



mcpalmer
01-13-2006, 12:20 AM
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:



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!

Twey
01-13-2006, 03:53 PM
Try:
var d = document.frames['mainframe'].document , cEl = null,sz = startSz,i,j,cTags;