...

View Full Version : HOW TO? -- puting a bunch of info into a popup from parent page?????



BrightNail
10-19-2005, 08:21 PM
Okay,

I have a LOT of info that I am 'hiding' on a page. I am hiding this info via a div tag.

Okay, I want to let a user click a 'popup' link, and then have that information put into a popup window.

The problem is, the amount of information is not so little to do a simple document.write and reference back to some variable.

I have ALOT of info that I am 'hiding' on the parent page. Basically, I only want to hit the server one time for this page, thus I give back the html page all information. The user then selects a link, and the popup shows the "rest of the info".

Is there a way to do this without a bunch of document.writes and such in the popup.

Can I somehow reference the contents of a div tag and display it in the popup? Whole tables and content and such?

please advise.

martin_narg
10-19-2005, 08:48 PM
how much information in KB mate? Also, does it require manipulation before putting into the popup?

m_n

BrightNail
10-19-2005, 09:04 PM
hmmm,

well, I am gonna be formatting it on the parent page....

so, the proper tables and headers and everything is in there...ala..

all the info here...complicated table structure showing
pricing figures and such. There could like 4 of these tables but with
much more data.
<div id="somediv">
<table>
<tr>
<td>item</td>
<td>price</td>
<td>size</td>
<td>color</td>
</tr>
<tr>
<td>car</td>
<td>$55000</td>
<td>med</td>
<td>red</td>
</tr>
<tr>
<td>shoe</td>
<td>$4</td>
<td>11</td>
<td>white</td>
</tr>
</table>
</div>

The amount of the KB for the popup, hmmm. I would imagine about, actually I don't know.
A fair amount. Like 3 fairly large tables with pricing/seating/product info..

thanks

_Aerospace_Eng_
10-20-2005, 12:12 AM
Here is one way.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript">
function openWin(url,what){
newwin=window.open(url,'','width=600,height=600,menubar=0,toolbars=0,scrollbars=1,status=0');
newwin.document.write('<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">\n');
newwin.document.write('<html>\n<head>\n<title></title>\n</head>\n<body>\n');
newwin.document.write(document.getElementById(what).innerHTML);
newwin.document.write('\n</body>\n</html>');
newwin.document.close();
}
</script>
</head>

<body>
<a href="index.html" onclick="openWin(this.href,'somediv');return false">Open win</a>
<div id="somediv">
<table>
<tr>
<td>item</td>
<td>price</td>
<td>size</td>
<td>color</td>
</tr>
<tr>
<td>car</td>
<td>$55000</td>
<td>med</td>
<td>red</td>
</tr>
<tr>
<td>shoe</td>
<td>$4</td>
<td>11</td>
<td>white</td>
</tr>
</table>
</div>
</body>
</html>
There might be a better way.

BrightNail
10-20-2005, 02:51 AM
awesome...this is exaclty what I was looking for...

Perfect! ---> thanks alot, I totally appreciate it.

BrightNail
11-28-2005, 09:01 PM
UPDATE!!!

Okay, I have a little problem.

The popup page will actually be dynamically created WITH THE html/body/title etc... already in it...

SO, how would I make this work..????

basically..

<html>
<head>
<title>some title </title>
<body>
SOME OTHER INFO DYNAMICALLY GENERATED FROM THE SERVER/APP

etc..

---> NEED THE DIV INFO HERE <---


closing..html etc.....

fishluvr
11-28-2005, 09:55 PM
You could try using:

<div id="popupWindowDiv">
<script type="text/javascript">
document.write(window.opener.document.getElementById('somediv').innerHTML);
</script>
</div>

in the popup window...

BrightNail
11-28-2005, 10:07 PM
I gotta laugh..that works - I just have to check it across different browsers...but that is so simple...hahaa, I tend to think too complicated....

I really appreciate it..thanks.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum