Quick help please with FRAMES (another question)

T

TrvlOrm

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>Exercise Left8-2 - LEFT FRAME PAGE with Document Object</TITLE>

<SCRIPT LANGUAGE="JavaScript">

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="JavaScript">

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(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'">

</FORM>
</BODY>
</HTML>

//*This is the RIGHT frame Page*\\
<HTML>
<HEAD>

<TITLE>Exercise 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>Exercise 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........
 
R

Richard Cornford

Trvl said:
Sorry Erwin.....What is 42 ?

The answer.

The answer to what?

Life, the Universe ... everything.

- from: "The Hitchhiker's Guide to the Galaxy" by Douglas Adams. :)

Probably intended to imply that your question was vague. (I cannot tell
because I haven't read your question, you have been top posting too much
recently to warrant that).

Richard.
 
T

Trvl Orm

Richard, it shouldn't matter how many posts a person does on this forum,
if they are seeking help.

I've posted because like many others, and seeking answers to my
question.
 
R

Randy Webb

Trvl said:
Richard, it shouldn't matter how many posts a person does on this forum,
if they are seeking help.

I've posted because like many others, and seeking answers to my
question.

What you have *not* done (like many others) is to consult the FAQ (URL
is in my signature) on proper posting style, what is the "norm" in this
group, and how to quote what you are replying to.

Adhering to those accepted standards will go a *long* way in getting you
an answer.
 
T

Trvl Orm

Ok...I am new at this JavaScript thing and new to the forum, so please
forgive me if I am missing something here....but what have I not done?

Is there some one who can please provide me with some help to my
problem?
 
K

kaeli

Ok...I am new at this JavaScript thing and new to the forum, so please
forgive me if I am missing something here....but what have I not done?

Well, for starters, you're getting this off Developersdex and thinking
everyone else is, too.
This is Usenet. Not a "forum". It's a forum for YOU because you aredn't
using a newsreader like most of use here.

Also, when you post, you are supposed to quote what you're talking about
before you reply to it.
See my post here. I quoted you above.
That way, people know what the hell I'm talking about. :)
Is there some one who can please provide me with some help to my
problem?

Well, since you didn't quote it and newsservers don't always keep the
beginning of a thread, what IS your problem? ;)

I see a couple things right away.
Frames are windows. Documents are in windows. This is misleading.
var leftFrame = top.frames[0].document;
var rightFrame = top.frames[1].document;
var rightDoc = top.frames[1];

A frame is a window.
var leftFrame = top.frames[0];

If you meant the doc, call it that.
var leftFrameDoc = top.frames[0].document;

top.frames[1] is a window, not a document.
<SCRIPT LANGUAGE="JavaScript">
shoule be
function checkField (field)
{
if (field.value == "") {

It is possible to pass a null field, at which time you'll get a null
object error for trying to access value. Change to

function checkField (field)
{
if (field == null || field.value == "") {

Note that that allows blanks. (" ")
Maybe not so good, eh?

Better...
function isBlank(val)
{
// True if val is whitespace only or empty.
var re = /\S+/;
return (!re.test(val));
}
if (! field || isBlank(field.value)

Also note that you forgot to return true for this function in the
success case.
AFAIK, that is deprecated.
<INPUT type="button" value="Go to the Right Page" name="rightbutton"
onClick="rightFrame.location='Right8-2.html'">

Better to load the whole frameset as one.
<INPUT type="button" value="Go to the Right Page" name="rightbutton"
onClick="top.location='Right8-2.html'">


Need more help, let me know.

--
 
R

Richard Cornford

Trvl said:
Richard, it shouldn't matter how many posts a person
does on this forum, if they are seeking help.

Did anyone say it did?
I've posted because like many others, and seeking
answers to my question.

And like those many others you are in a position to take action to
influence the number, nature and quality of the answers you get (the FAQ
is very detailed on the subject). Posting to Usenet without any regard
for the established conventions is not an action that should be expected
to have a positive impact upon the outcome.

Richard.
 
T

Trvl Orm

Ok thanks so much Kaeli for your help so far.

Yes, if you wouldn't mind I do need a bit more help with my Frames
page...Like I said before I am new to JavaScript and this forum, so any
help I can get is great.
Well, since you didn't quote it and newsservers don't >always keep the
beginning of a thread, what IS your problem? ;)

My problem has been mentioned in my first post, I am attaching it to
this message again, for those of you who can help....

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)

Any ideas? and thank you so much so far.....

(All 3 pages of coding below...)

//* This is the LEFT FRAME PAGE *\\
<HTML>
<HEAD>

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

<SCRIPT LANGUAGE="JavaScript">

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="JavaScript">

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(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'">

</FORM>
</BODY>
</HTML>

//*This is the RIGHT frame Page*\\
<HTML>
<HEAD>

<TITLE>Exercise 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>Exercise 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........
 
T

TrvlOrm

Can any one please help me?

I may or may not be doing the correct way to post to these forums, but
I
am very new at this, and not entirely sure what I am doing
incorrectly. All I am seeking for is some help to a major problem,
which needs to be resolved a s a p...please help....

See first post for my problem

Thank you.
 
R

Richard Cornford

TrvlOrm said:
Can any one please help me?

Oh yes, many will be able to help you. What you are struggling with at
the moment is achieving a coincidence of ability to help and willingness
to help.
I may or may not be doing the correct way to post to these
forums, but I am very new at this, and not entirely
sure what I am doing incorrectly.

One of the accusations levelled against individuals who top-post over
verbatim quotes is that they display evidence of having not bothered to
actually read the messages that they are replying to. If you review the
responses that you have received on this group to date you will find a
recurrent theme (in the form of an acronym), and you will find that
there is a reason that it is recurrent.
All I am seeking for is some help to a major problem,
which needs to be resolved a s a p...please help....

See first post for my problem

So you have decided to react to the suggestion that your original
question may have been too vague to actually be answered by just
referring people back to it? (Incidentally, changing the subject line
will have resulted in your original post being disassociated from your
last message at groups.goolgle.com)

<snip>

Richard.
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen
I may or may not be doing the correct way to post to these forums, but
I
am very new at this, and not entirely sure what I am doing
incorrectly. All I am seeking for is some help to a major problem,
which needs to be resolved a s a p...please help....

See first post for my problem


Do not top-post. Do not over-quote. Don't quote signatures.

Read the newsgroup FAQ until you are reasonably familiar with what is in
Section 4, and have a thorough understanding of Section 2.3.

Once you demonstrate that you can do that, you will find that the
knowledgeable readers here will be better able, and more willing, to
help with scripting problems.
 
K

kaeli

Ok thanks so much Kaeli for your help so far.
You're welcome.

Here. Watch for word-wrap.

<HTML>
<HEAD>

<TITLE>Exercise 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>


<HTML>
<HEAD>

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

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">

var leftFrame = top.frames['LeftFrame'].document;
var rightFrame = top.frames['RightFrame'].document;
var rightDoc = top.frames['RightFrame'];

function checkField (field)
{
if (field.value == "")
{
alert("Please enter a Background Color");
field.focus();
return false; // don't submit the form
}
return true;
}

</SCRIPT>
</HEAD>

<BODY>

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

<SCRIPT LANGUAGE="JavaScript" type="text/javascript">
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">
Enter a Back Ground Color: <INPUT TYPE="text" Name="MyFieldData">&nbsp;
<INPUT TYPE="button" onClick="if (checkField(this.form.MyFieldData))
rightFrame.bgColor=this.form.MyFieldData.value;" value="Submit"><br>

<INPUT TYPE="button" VALUE="Change Back Ground Color" NAME="MyField"
onClick="rightFrame.bgColor='blue' "><br>
<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()"><br>
<INPUT type="button" value="Go to the Right Page" name="rightbutton"
onClick="top.location='Right8-2.html'">

</FORM>
</BODY>
</HTML>


<HTML>
<HEAD>

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

<body>

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

</body>
</HTML>


--
--
~kaeli~
I love God.
It's His fanclub that I can't stand.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top