PDA

View Full Version : IFRAME Javascript menu


steve55
09-05-2002, 11:20 AM
Hi,

I have found a great script at http://www.draac.com/dropdown-menu-iframe.html which I am playing around with.

However I can't get the background colour of the frame to be anything other than white - even if I specify a colour in the <IFRAME> tag...

Is there a way of amending this in the javascript? The code is as follows:

<HEAD>

<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function leapto(form) {
var myindex=form.dest.selectedIndex
parent.SURFCAMS.location.href=(form.dest.options[myindex].value);
// You can output to ANY frame using: parent.[framename].location.href
}
// End -->
</SCRIPT>
</HEAD>

<FORM NAME="myform">
<SELECT NAME="dest" SIZE=1 onChange="leapto(this.form)">
<OPTION SELECTED VALUE="">Choose A Link
<OPTION VALUE="http://www.lycos.com/">Lycos.Com
<OPTION VALUE="http://www.google.com/">Google.Com
<OPTION VALUE="http://www.yahoo.com/">Yahoo.Com
</SELECT>
</FORM>

<iframe width="650" height="400" name="CONTENT" bgcolor="#003366">

-----------------------------
</iframe>

beetle
09-05-2002, 03:11 PM
The "background-color" of an IFRAME isn't really a property of the IFRAME at all.

The background-color you see belongs to the document contained by the IFRAME

steve55
09-05-2002, 03:26 PM
bummer - so there is basically nothing I could do to avoid a big square patch of white appearing on my blue page...

beetle
09-05-2002, 03:35 PM
Well, depends on the what pages you are loading into the IFRAME. If you have editing control over those pages, you can change their background color to blue as well, or use the transparency that IFRAMEs allow (IE5.5+ only, that I know of)

If you don't have editing control, then no, nothing you can do.

Note: for security reasons, you cannot dynamically affect any pages loaded into an IFRAME unless those pages are within the parent window's domain.