View Full Version : Quick help needed with FRAMES

05-07-2004, 02:54 AM
OK. After much playing around, I managed to get my frame page this far.. see code below.

BUT...there are still errors with it, and what I would like to have happened is this:

1) On the Left Frame (File LeftEx8_2.html) a series of buttons, which when clicked prompt the user to enter information for background color, text color, link color, title and some text.

BUT HERE IS MY PROBLEM: some buttons have been started in the left frame, but not all of them and when clicked all the above listed information should show up on the Right frame.

2) Left frame should also have a button to go to the Right frame (File RightEx8_2.html) page.

The contents of the LEFT frame should be present on the RIGHT frame, when the final click of a button has been pushed by the user. (File: Ex8_2.html)

So....How do I get all this to work? I have had tremendous help so far, although not quite what I have been looking for..anyways I'm really confused on this and am seeking help please.....

I noted on some of the responses, people have been quoting XHTML. I am a new Javascript user (and perfer this page to be done without a cascading style sheet, and XHTML. Just plain HTML please)..I have to use Notepad for creating the script, and Internet Explorer version 6.0 to view what had been created.

Any ideas?
(All 3 pages of coding below...)

//* This is the LEFT FRAME PAGE *\\

<TITLE>Exercise Left8-2 - LEFT FRAME PAGE with Document Object</TITLE>


var leftFrame = top.frames[0].document;
var rightFrame = top.frames[1].document;
var rightDoc = top.frames[1];

function checkField (field)
if (field.value == "") {
alert("Please enter a Back ground Color");

return false; // don't submit the form




<H3>This is the left document of Exercise 8-2</H3>


var username = prompt("Welcome to Exercise 8-2", "Enter your name here");
// alert("Welcome to Exercise 8-2");

document.write(username + " Welcome to Exercise 8-2");


<H1 Align=center> <Font Face=Arial Color=Green> Exercise 8-2 - JavaScript Buttons </Font></H1>
<Font Face=Arial Size=3 Color=Green>

<FORM NAME="FrmMyForm" action="Right8-2.html" onSubmit = "return checkField(MyFieldData);">
Enter a Back Ground Color:
<INPUT TYPE="text" Name="MyFieldData" onBlur="">
<INPUT TYPE="Submit">

<INPUT TYPE="button" VALUE="Change Back Ground Color" NAME="MyField" onClick="rightFrame.bgColor='blue' ">

<INPUT type="button" value="Change to Red!" name="redbutton" onClick="rightFrame.bgColor='red'"> <br>

<INPUT type="button" value="Change to Yellow!" name="yellowbutton" onClick="rightFrame.bgColor='yellow'"> <br>

<INPUT type="button" VALUE="Change to Blue!" NAME="Bluebutton" onClick="rightFrame.bgColor='blue'"><BR>

<INPUT TYPE="button" NAME="buttonPrint" VALUE="Print" onClick="rightDoc.print()">

<INPUT type="button" value="Go to the Right Page" name="rightbutton" onClick="rightFrame.location='Right8-2.html'">


//*This is the RIGHT frame Page*\\

<TITLE>Exercise Right8-2 - Right FRAME PAGE with Document Object</TITLE>


<H3>This is the right document of Exercise 8-2</H3>


//*and This is the MAIN Frame Page - Ex8_2.html*\\

<TITLE>Exercise 8-2 - FRAME PAGE with Document Object</TITLE>


<FRAMESET COLS="50%,50%">

<FRAME NAME=LeftFrame SRC="Left8-2.html" name= "lFr">
<FRAME NAME=RightFrame SRC="Right8-2.html" name = "rFr">

That's it. Would appreaciate any help on this........