Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
calling function in parent window and displaying data
Old 04-13-2009, 03:20 AM calling function in parent window and displaying data
Junior Talker

Posts: 1
Name: Robert
Trades: 0
Hey guys.
Cool forum. I am new to this forum and javascript. I am taking this beginng class and I am almost done with my program but I do not know how to have my child window call the function in the parent.html window. Well I have it call it but I want it to display the data below the buttons of the parentwindow under the line it makes and I do not want the parent window to dissapear and put the data on the new line. Plus I do not know how to display the data values I want..I want to call the function in the parent.html file window by clicking on the child window confirm order. And the have child window dissapear displaying the data in a row below the line and buttons of the first window that popped up. I have no way to understand this. can yu guys give me some good direction. Thank you.



parent.html
Code:
<HTML>
<HEAD>
<TITLE>Parent Window</TITLE>
</HEAD>
<BODY>
<CENTER>
<H2>Robert's Pizza Palace</H2>
<h5>Welcome!</h5>
<HR SIZE=5 WIDTH=90%>
</Center>
<TABLE>
<TD>
</TD>
<TD>
<PRE>
<FORM NAME="OrderForm">
<B>Name:               </B><INPUT TYPE=TEXT NAME="name" ID="name">
<B>Address:            </B><INPUT TYPE=TEXT NAME="address" ID="address">
<B>Phone:              </B><INPUT TYPE=TEXT NAME="phone" ID="phone">
<B>Quantity Ordered:   </B><INPUT TYPE=TEXT NAME="qtypizzas" ID="qtypizzas">
<B></B>
<INPUT type="button" value="Place Order" onClick="window.open('3b.html', 'ConfirmOrder','width=600,height=450')">
<INPUT TYPE="RESET" VALUE="Clear">
</PRE>
</FORM>
</TD>
</TABLE>
<HR SIZE=5 WIDTH=90%> 
<script language="JavaScript">
function DisplayConfirmData()
//this function does not work 
{
 window.focus(); 
 document.write("Qty" + " + ""Phone"+ " " + "Name");
 document.write(QtyPizzas + Phone + Name);
}
</script>
</BODY>
</HTML>
child.html
Code:
<HTML>
<HEAD>
<TITLE>Pizza Order Confirmation</TITLE>
</HEAD>
<BODY>
<CENTER>
<H3>Robert's Pizza Palace!</H3>
<h5>Confirm Your Order Please.</h5>
<h5>Thank You!</h5>
<HR SIZE=5 WIDTH=90%> 
</Center>
<TABLE>
<TD>
</TD>
<TD>
<PRE>
<SCRIPT language="JavaScript"><!--
 var Name = window.opener.document.OrderForm.name.value
 var Phone = window.opener.document.OrderForm.phone.value
 var QtyPizzas = window.opener.document.OrderForm.qtypizzas.value
 document.write ("Hello " + Name );
 document.write (", You have ordered " + QtyPizzas +  " pizzas.<br>");
 document.write ("You will receive a call shortly at " + Phone + ".");
 
function CallParentWindowFunction()
    {
//trying to pass values back to parent.html while it stays open? 
      window.parent.DisplayConfirmData(Name,Phone, QtyPizzas);
      window.close();
      return false;
    }
</SCRIPT>
<INPUT TYPE="BUTTON" NAME="Order" VALUE="Confirm Order"
onclick="javascript:return CallParentWindowFunction();"/>
<INPUT TYPE="BUTTON" VALUE="Cancel"
onclick="window.close()">
</pre>
</table>
</body>
</html>

Last edited by jsnewby; 04-13-2009 at 03:23 AM..
jsnewby is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Reply     « Reply to calling function in parent window and displaying data
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.07780 seconds with 12 queries