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 *\\
<HTML>
<HEAD>
<TITLE>Exerci se Left8-2 - LEFT FRAME PAGE with Document Object</TITLE>
<SCRIPT LANGUAGE="JavaS cript">
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");
field.focus();
return false; // don't submit the form
}
}
</SCRIPT>
</HEAD>
<BODY>
<H3>This is the left document of Exercise 8-2</H3>
<SCRIPT LANGUAGE="JavaS cript">
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");
</SCRIPT>
<H1 Align=center> <Font Face=Arial Color=Green> Exercise 8-2 -
JavaScript Buttons </Font></H1>
<Center>
<Font Face=Arial Size=3 Color=Green>
<FORM NAME="FrmMyForm " action="Right8-2.html" onSubmit = "return
checkField(MyFi eldData);">
Enter a Back Ground Color:
<INPUT TYPE="text" Name="MyFieldDa ta" onBlur="">
<INPUT TYPE="Submit">
<INPUT TYPE="button" VALUE="Change Back Ground Color" NAME="MyField"
onClick="rightF rame.bgColor='b lue' ">
<INPUT type="button" value="Change to Red!" name="redbutton "
onClick="rightF rame.bgColor='r ed'"> <br>
<INPUT type="button" value="Change to Yellow!" name="yellowbut ton"
onClick="rightF rame.bgColor='y ellow'"> <br>
<INPUT type="button" VALUE="Change to Blue!" NAME="Bluebutto n"
onClick="rightF rame.bgColor='b lue'"><BR>
<INPUT TYPE="button" NAME="buttonPri nt" VALUE="Print"
onClick="rightD oc.print()">
<INPUT type="button" value="Go to the Right Page" name="rightbutt on"
onClick="rightF rame.location=' Right8-2.html'">
</FORM>
</BODY>
</HTML>
//*This is the RIGHT frame Page*\\
<HTML>
<HEAD>
<TITLE>Exerci se Right8-2 - Right FRAME PAGE with Document
Object</TITLE>
</head>
<body>
<H3>This is the right document of Exercise 8-2</H3>
</body>
</HTML>
//*and This is the MAIN Frame Page - Ex8_2.html*\\
<HTML>
<HEAD>
<TITLE>Exerci se 8-2 - FRAME PAGE with Document Object</TITLE>
</HEAD>
<FRAMESET COLS="50%,50%">
<FRAME NAME=LeftFrame SRC="Left8-2.html" name= "lFr">
<FRAME NAME=RightFrame SRC="Right8-2.html" name = "rFr">
</FRAMESET>
</HTML>
That's it. Would appreaciate any help on 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 *\\
<HTML>
<HEAD>
<TITLE>Exerci se Left8-2 - LEFT FRAME PAGE with Document Object</TITLE>
<SCRIPT LANGUAGE="JavaS cript">
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");
field.focus();
return false; // don't submit the form
}
}
</SCRIPT>
</HEAD>
<BODY>
<H3>This is the left document of Exercise 8-2</H3>
<SCRIPT LANGUAGE="JavaS cript">
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");
</SCRIPT>
<H1 Align=center> <Font Face=Arial Color=Green> Exercise 8-2 -
JavaScript Buttons </Font></H1>
<Center>
<Font Face=Arial Size=3 Color=Green>
<FORM NAME="FrmMyForm " action="Right8-2.html" onSubmit = "return
checkField(MyFi eldData);">
Enter a Back Ground Color:
<INPUT TYPE="text" Name="MyFieldDa ta" onBlur="">
<INPUT TYPE="Submit">
<INPUT TYPE="button" VALUE="Change Back Ground Color" NAME="MyField"
onClick="rightF rame.bgColor='b lue' ">
<INPUT type="button" value="Change to Red!" name="redbutton "
onClick="rightF rame.bgColor='r ed'"> <br>
<INPUT type="button" value="Change to Yellow!" name="yellowbut ton"
onClick="rightF rame.bgColor='y ellow'"> <br>
<INPUT type="button" VALUE="Change to Blue!" NAME="Bluebutto n"
onClick="rightF rame.bgColor='b lue'"><BR>
<INPUT TYPE="button" NAME="buttonPri nt" VALUE="Print"
onClick="rightD oc.print()">
<INPUT type="button" value="Go to the Right Page" name="rightbutt on"
onClick="rightF rame.location=' Right8-2.html'">
</FORM>
</BODY>
</HTML>
//*This is the RIGHT frame Page*\\
<HTML>
<HEAD>
<TITLE>Exerci se Right8-2 - Right FRAME PAGE with Document
Object</TITLE>
</head>
<body>
<H3>This is the right document of Exercise 8-2</H3>
</body>
</HTML>
//*and This is the MAIN Frame Page - Ex8_2.html*\\
<HTML>
<HEAD>
<TITLE>Exerci se 8-2 - FRAME PAGE with Document Object</TITLE>
</HEAD>
<FRAMESET COLS="50%,50%">
<FRAME NAME=LeftFrame SRC="Left8-2.html" name= "lFr">
<FRAME NAME=RightFrame SRC="Right8-2.html" name = "rFr">
</FRAMESET>
</HTML>
That's it. Would appreaciate any help on this........
Comment