By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,922 Members | 1,861 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,922 IT Pros & Developers. It's quick & easy.

Display input form results in another frame

P: 1
Hi all,

I am very new to Javascript and I am in some need of some help. I am creating a site that has a madlib. I got the madlib code but now I want the results of the madlib to display in another frame. The user input will be in one from and the output should be in seperate frame. I have written the code for the madlib but when I hit the submit button it does not do anything. Here are my codes for the pages.

The frameset code is

<script language="JavaScript">
function passText(str) {
top.frames['right'].document.yourform.msg.value = str;
<frameset cols="50%,50%*" frameborder=1>
<frame name="left" src="form.html" NORESIZE SCROLLING=YES>
<frame name="right" src="madlibresults.html" NORESIZE SCROLLING=NO>
The user input page code is

function create(form) {
var start="go";
if (start=="go") {
text = ("<HEAD><TITLE>Mark Anthony's Address from 'Julius Caesar' </TITLE> </HEAD>");
text += ("<BODY BGCOLOR = '#FFFFFF'><CENTER><B><FONT FACE = 'Arial' SIZE = 4>");
text += ("Mark Anthony's Address from<BR> 'Julius Caesar' </FONT></B></CENTER><BR>");
text += ("Friends, Romans, " +form.input1.value+ " lend me your " +form.input2.value+ "; ");
text += ("I come to " +form.input3.value+ " Caesar, not to praise him. ");
text += ("The evil that men do lives after them, the good is oft interred with their " +form.input4.value+ "; ");
text += ("so let it be with " +form.input5.value+ ". " );
text += ("The noble Brutus hath told you Caesar was " +form.input6.value+ "; if it were so, it was a grievous fault. ");
text += ("If you have " +form.input7.value+ ", prepare to shed them now. ");
text += ("You all do know this " +form.input8.value+ ". ");
text += ("I remember the first time Caesar put it on. ");
text += ("Through this well-beloved Brutus stabbed; for Brutus, as you know, was Caesar's " +form.input9.value+ ": ");
text += ("this was the unkindest " +form.input10.value+ " of all. ");
text += ("Here is the " +form.input11.value+ ", under Caesar's seal. To every Roman " +form.input12.value+ " he gives, ");
text += ("to every several man, seventy five " +form.input13.value+ ". ");
text += ("Here was a/an " +form.input14.value+ "! When comes another?");
Fill in the form, and then press the button for your own Julius Caesar Madlib.
Plural Noun:<TD><INPUT TYPE="text" NAME="input1" SIZE=20><BR>
Part of body (plural):<TD><INPUT TYPE="text" NAME="input2" SIZE=20 ><BR>
Verb:<TD><INPUT TYPE="text" NAME="input3" SIZE=20 ><BR>
Name:<TD><INPUT TYPE="text" NAME="input4" SIZE=20 ><BR>
Name of Polictician:<TD><INPUT TYPE="text" NAME="input5" SIZE=20 ><BR>
Adjective:<TD><INPUT TYPE="text" NAME="input6" SIZE=20 ><BR>
Article of Clothing:<TD><INPUT TYPE="text" NAME="input7" SIZE=20 ><BR>
Article of Clothing:<TD><INPUT TYPE="text" NAME="input8" SIZE=20 ><BR>
Occupation:<TD><INPUT TYPE="text" NAME="input9" SIZE=20 ><BR>
Noun:<TD><INPUT TYPE="text" NAME="input10" SIZE=20 ><BR>
Noun:<TD><INPUT TYPE="text" NAME="input11" SIZE=20 ><BR>
Noun:<TD><INPUT TYPE="text" NAME="input12" SIZE=20 ><BR>
Animal (plural):<TD><INPUT TYPE="text" NAME="input13" SIZE=20 ><BR>
A Food:<TD><INPUT TYPE="text" NAME="input14" SIZE=20 ><BR>
<INPUT TYPE="button" VALUE="Submit" target="madlibresults">
Now I want the madlib to display in the madlibresults page. I want the final story to be in hte madlibresults frame and not have the user have to scroll. Can anyone help me get this working right?

Thank you very much!
Feb 15 '08 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 16,027
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Feb 16 '08 #2

Expert Mod 15k+
P: 16,027
You can find out how to access frames and the frame hierarchy in JavaScript with this link.

You could set the right frame as the target of the form and retrieve the values from the URL in the right frame.
Feb 16 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.