To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here
PHPBuilder.com  
 

 

Go Back   PHPBuilder.com > Misc Help > ClientSide Technologies

ClientSide Technologies Discuss HTML/CSS/Javascript, and any other client-side technologies, here.

Reply
 
Thread Tools Rate Thread Display Modes
Old 04-26-2006, 09:19 PM   #1
scrupul0us
I see what you did there
 
Join Date: Sep 2004
Location: Albany, NY
Posts: 1,621
send div contents to a popup

Basically... when I click this here form button I need the popup to grab everything from a specific DIV on the main page (where the button was)

thanks
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***

Buy Chris Shiflett's Book Essential PHP Security

Dev Server: Apache 2.2.x | PHP 5.2.6 | MySQL 5.x

PHP Manual | Learn HTML | Validate HTML
scrupul0us is offline   Reply With Quote
Old 04-27-2006, 01:23 AM   #2
bpat1434
NMaOtBG
 
bpat1434's Avatar
 
Join Date: Oct 2004
Location: Around 255.255.255.0
Posts: 8,093
It's not technically sending the information to the page, but really the pop-up is reading from it's caller using the self.opener method.

Basically, when you click the popup button/link a preset div is looked for in the parent window. If you need a dynamic pop-up, you'll have to figure something out. I gave you a good stepping stone.

first page
HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus" />
<meta name="Author" content="" />
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<script language="JavaScript" type="text/javascript"><!--
function popWindow()
{
	var pop = window.open('info.html','','width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
	if(pop.focus){ pop.focus(); }
}
--></script>
</head>

<body>
<input type="button" name="click" value="Pop Up!!" onclick="javascript:popWindow();"/>
<div id="info" style="visibility: hidden;">
Test test test...<b>SOme Test content</b>
</div>
</body>
</html>
info.html
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Requested Info </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script language="JavaScript" type="text/javascript"><!--
function showIt() {
	var cont = self.opener.document.getElementById('info').innerHTML;
	document.getElementById('info').innerHTML = cont;
}

window.onload = function(e){
	showIt();
}
--></script>
</head>

<body>
<div id="info"></div>
</body>
</html>
Alternatively if it's multiple forms or something... you can do something like this:
first page
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script type="text/javascript" language="JavaScript">
<!--
function popWindow(wName){
	features = 'width=400,height=400,toolbar=no,location=no,directories=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no';
	pop = window.open('',wName,features);
	if(pop.focus){ pop.focus(); }
	return true;
}
-->
</script>
</head>

<body>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="23 years old">
<input type="hidden" name="experience" value="expert">
<input type="submit" value="John">
</form>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="26 years old">
<input type="hidden" name="experience" value="novice">
<input type="submit" value="James">
</form>
<form action="js_pop.php" method="post" target="Details" onSubmit="return popWindow(this.target)">
<input type="hidden" name ="age" value="21 years old">
<input type="hidden" name="experience" value="intermediate">
<input type="submit" value="Jack">
</form>
</body>
</html>
js_pop.php
PHP Code:
<pre><?php

var_dump
($_POST);

?></pre>
And display only the form that they hit the button in. That was created for an earlier post on here, but I cant' seem to find it now.... hmm.....

Last edited by bpat1434; 04-27-2006 at 01:32 AM.
bpat1434 is offline   Reply With Quote
Old 04-27-2006, 10:01 AM   #3
scrupul0us
I see what you did there
 
Join Date: Sep 2004
Location: Albany, NY
Posts: 1,621
after some tweaking I'ev got the basic functionality down... when i press the form submit button i get my popup and it draws the div containing the form into it... but, if I enter any information into the form, then clickthe button, I just get a blank popup

i might have to submit the form back to itself putting the values into the html FIRST and THEN allowing the user to "popup" the form for printing

lest you know why its blowing up
__________________
***If your problem has been solved, PLEASE click the RESOLVED LINK under "Thread Tools"***

Buy Chris Shiflett's Book Essential PHP Security

Dev Server: Apache 2.2.x | PHP 5.2.6 | MySQL 5.x

PHP Manual | Learn HTML | Validate HTML
scrupul0us is offline   Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 07:27 AM.






Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.