Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 6th, 2005, 03:27 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
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...




Reply With Quote
  #2 (permalink)  
Old March 6th, 2005, 05:27 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
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
Reply With Quote
  #3 (permalink)  
Old March 6th, 2005, 05:51 AM
Authorized User
 
Join Date: Mar 2005
Location: Pune, Maharashtra, India.
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.

Reply With Quote
  #4 (permalink)  
Old March 6th, 2005, 06:24 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
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)
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:03 PM.


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