Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
|
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2005, 03:27 AM
Registered User
 
Join Date: Feb 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to pass values to anther page using javascript


i want to pass values to another page and that page will open in dfferent window. i used window.open function in javascript but unable to pass values to it.

help me pls...




 
Old March 6th, 2005, 05:27 AM
Friend of Wrox
 
Join Date: Oct 2004
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Two ways to pass values in the new window.

str="mypage.asp?name="+value1+"&name2="+value2

then use this str in
window.open(str,"winname","height=400,width=500);

Another way is to use --> window.parent.parentformname.fieldname.value
in child window to access the value of parent window.

Hope this will help you.



Cheers :)

vinod
 
Old March 6th, 2005, 05:51 AM
Authorized User
 
Join Date: Mar 2005
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to dadahonde Send a message via Yahoo to dadahonde
Default

Yes The above 2 ways are the best u can use to pass values to next page in javascrpt.

 
Old March 6th, 2005, 06:24 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

When you use window.open it returns a reference to the new window. You can use that to pass information:
Code:
var oNewWin = window.open(.....);
oNewWin.newVariable = "Joe";
Then in your child window:
Code:
alert(window.newVariable);
Alternatively you can access the parent from the child using window.opener:
Code:
alert(window.opener.location);

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to pass values from javascript to xml file satish_sgk Javascript How-To 1 November 24th, 2007 07:27 PM
Pass values from Aspx page to Flash Muthunagai.A ASP.NET 1.0 and 1.1 Professional 0 April 25th, 2007 11:43 PM
Pass values from Aspx page to Flash Muthunagai.A Excel VBA 0 April 25th, 2007 11:37 PM
help me to pass the check box values to new page ansar BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 0 November 16th, 2004 06:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.