JavaScript Images and Frames

They have: 15 posts

Joined: Dec 1999

I'm trying to create a frame page that will allow the user to pick a hyperlink and see the image ane the background on seperate pages. The HTML code for the three pages looks like this:

<HTML>

<TITLE>Backgrounds I have found</TITLE>

<FRAMESET COLS="*,*">
<FRAME SRC="background1.htm">

<FRAMESET ROWS="*,*">
<FRAME SRC="background2.htm" NAME="IMG">
<FRAME SRC="background3.htm" NAME="PAGE">
</FRAMESET>

</FRAMESET>

</HTML>

Is there any way to do that?

They have: 89 posts

Joined: Sep 1999

Sure. I have designed this as a onmouseover event, but you can adjust it to display with whatever event that you want.

This script would go in the background1 frame and display two different images in background2 and 3 frames onmouseover.

<script language="javascript">

function clsImg() {
parent.IMG.document.open();
parent.IMG.document.write('<BODY BGCOLOR="#FFFFFF">');
parent.IMG.document.close();
}

function clsPage() {
parent.PAGE.document.open();
parent.PAGE.document.write('<BODY BGCOLOR="#FFFFFF">');
parent.PAGE.document.close();
}

function imgShow() {
clsImg()
parent.IMG.document.open();
parent.IMG.document.write('<body background="img.jpg">');
parent.IMG.document.close();
}

function pageShow() {
clsPage()
parent.PAGE.document.open();
parent.PAGE.document.write('<body background="background.jpg">');
parent.PAGE.document.close();
}
</script>
</head>
<a href="blah.html" onmouseover="imgShow(); pageShow()" onmouseout="clsPage(); clsImg()">Here is a really cool image and background!</a>

They have: 15 posts

Joined: Dec 1999

The code dosn't work right. It only shows up in one place, the background2.htm page.

[This message has been edited by randygordjr (edited 05 January 2000).]

They have: 89 posts

Joined: Sep 1999

It works fine for me. I can't think of any reason that it would work in one frame but not another except for an error somewhere.....check these things:

make sure that the frame names are the same as what is being called in the script (IMG and PAGE)

make sure the image file names are correct

check to see if the script was copied exactly as above with your image files substituted

let me know how it goes

They have: 15 posts

Joined: Dec 1999

There must be something wrong with the code or the way I'm putting it in. Is there another way to do it?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.