HTML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignHTML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 12th, 2000, 03:29 AM
asktan asktan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 13 asktan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I am going to write a code below:

-opening a popup window for user to choose any one of the 3 choices (using radio button, with button "select").

-The new window displays the 3 choices and passes the selected choice back to the the main window when press button "select" and display at one text box at main window.

(p/s: one main window + one pop up window)

thank you.

Reply With Quote
  #2  
Old May 12th, 2000, 07:49 AM
scollo scollo is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 1999
Posts: 114 scollo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 42 m 44 sec
Reputation Power: 10
In the pop-up window, you can refer back to the main window by using:

self.opener

So your code might look something like

self.opener.mainform.my_text_element.value = xxx;

Reply With Quote
  #3  
Old May 12th, 2000, 08:41 PM
asktan asktan is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 13 asktan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Below is the two html file, can you tell me what problem with this source code, why I can't get the value ?

--------------------------------
This is my main form(form.html):
--------------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript">
function windowopener(){
controlWindow=window.open("window.html","","toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width=220,he ight=265");
}
</script>
</head>
<body bgcolor="#FFFFFF">
<form name="mainform">
<p>Vtype
<select name="vtype">
<option value="-1" selected>[ Select One ]</option>
<option value="PC">Private Car</option>
<option value="T">Taxi</option>
</select>
<input type="submit" name="choose" value="Choose" onclick="windowopener()">
</p>
<p>CC
<input type="text" name="cc">
</p>
</form>
<p>&nbsp;</p>
</body>
</html>

-------------------------------------
This is my pop up window(window.htm):
-------------------------------------
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<script language="JavaScript">
function getresult(choose){
self.opener.mainform.cc.value=choose;
window.close();
}
</script>
<form name="form1" >
<p>
<input type="radio" name="choose" value="select1">
select 1 </p>
<p>
<input type="radio" name="choose" value="select2">
select 2 </p>
<p>
<input type="radio" name="choose" value="select3">
select 3</p>
<p>
<input type="submit" name="select" value="select" onclick=getresult(choose)>
<input type="button" name="close" value="close" onclick="window.close()">
</p>
</form>
</body>
</html>

Reply With Quote
  #4  
Old June 2nd, 2000, 02:40 AM
tanvi tanvi is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 1 tanvi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by asktan:
Below is the two html file, can you tell me what problem with this source code, why I can't get the value ?

[/quote]
In form.html change the type of "choose" from "submit" to "button".

I am writing the whole window.html here.

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF">
<script language="JavaScript">
function getresult(){
for(i=0; i<3; i++)
{
if(document.forms[0].elements[i].checked)
{
var the_value = document.forms[0].elements[i].value;
}
}
self.opener.mainform.cc.value=the_value;
window.close();
}
</script>
<form name="form1" >
<p>
<input type="radio" name="choose" value="select1">
select 1 </p>
<p>
<input type="radio" name="choose" value="select2">
select 2 </p>
<p>
<input type="radio" name="choose" value="select3">
select 3</p>
<p>
<input type="button" name="select" value="select" onclick=getresult()>
</p>
</form>
</body>
</html>


[This message has been edited by tanvi (edited June 02, 2000).]

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignHTML Programming > popup window -> get value to main form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway