Solved

Make 2 pages show on 1 page

Posted on 2004-05-01
14
148 Views
Last Modified: 2010-04-06
Hi

Sorry for the doddgy Q tiltle - i don't want frames.

What i meant was

I'm using a script that brings in results 10 at a time by whatever rank i specify (popular, alphabetical etc.)

the address bar shows something like

http://mydomain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=1

 for the next 10 results you click next and get

http://mydoamiain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=2


What i'd like to do is bring up page_num=1 and page_num=2 on the same page. And maybe page_num=(upto whatever) as well.

Thanks




0
Comment
Question by:macuser777
  • 7
  • 6
14 Comments
 
LVL 10

Expert Comment

by:eeBlueShadow
ID: 10969117
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 105 total points
ID: 10969161
Just use iframes:

<body>
<iframe src="http://mydomain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=1">
</iframe>
<iframe src="http://mydoamiain.com/cgi-bin/us.cgi?locale=us&mode=cat&node=2&sort_type=%2rank&page_num=2".
</iframe>

You can use as many iframes as you want to bring in as many pages as you want.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969331
Hi

The iframes is doing the job - but i've never used them before so can you help me format them a bit?

This test page

I'd like the 1-10 and 11-20 to show without scrolling
- no horizontal scroll bar
- AdSense to show up inbetween

http://www.amazoneasyview.com/cd.html

Eventually i want all this to show up as a left fram on another page with one vertical scroll for the whole lot.

0
Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969356
TryL
<iframe src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " style="height:auto">
</iframe>

If that does not work you may have set it dynamically using Javascript.  However you will have a better chance of getting thing to work reliably if you use valid html.  That page is incomplete there is only a body.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969437
Hi

I should have put the proper head content in to test - sorry - bad habit.

The AdSense works with the proper head content.

Overall it kinda works ok now - i found some iframe width,height attribute stuff to add.
It would be much better with an auto height though.

I'll leave the q. for a bit in case any ideas on the height thing.

Otherwise - invaluable help as ever :) - thanks
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969519
We still have something else we can try.  Give both the iframes an id.  id="IF1" and id="IF2" and a name:
name="NIF1" and name="NIF2"

Get rid of the height and then do the body of the page this way:
<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

Then put this script in the head:

<script type="text/javascript">
function setH(frm,fname)
{
   obj=document.getElementById(frm);
   obj.style.height=top.frames[fname].document.body.scrollHeight+'px';
}
</script>

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969588
Id didn't work but i might have coded it wrong...maybe left in some iframe attributes that should be edited out...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<script type="text/javascript">
function setH(frm,fname)
{
   obj=document.getElementById(frm);
   obj.style.height=top.frames[fname].document.body.scrollHeight+'px';
}
</script>



</head>

<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

<Div align="center">

<iframe marginwidth="0" marginheight="0" width="190"  scrolling="no" frameborder ="0" id="IF1" name="NIF1"  src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " > 
</iframe>


<BR><BR>

<iframe marginwidth="0" marginheight="0" width="190" id="IF2" name=" NIF2" scrolling="no" frameborder="0" src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=2 " >
</iframe>


<div>

</body>

</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10969607
Okay, I'll take another look in the morning... I'm about to call it a night.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10969618
me too...it's 1.am + in the UK...see ya later

macuser
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10971672
Let's try it from the other direct and run a method inside the iframe window:

<script type="text/javascript">
function setH(frm,fname)
{
   H=top.frames[fname].document.body.scrollHeight;
   top.frames[fname].resizeTo(190,(H+10));
}
</script>

That should work as long as the pages are coming form th esame domain.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 10973447
The pages are coming from the same domain in a sense.
It's my domain - but it picks up the info from an amazom XML feed which i just plug into.

Didn't work though.

When you say try and run a method from inside the iframe window
i'm assuming you didn't mean to put the code in the <iframe...

this is what i tried

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<script type="text/javascript">
function setH(frm,fname)
{
   H=top.frames[fname].document.body.scrollHeight;
   top.frames[fname].resizeTo(190,(H+10));
}
</script>


</head>

<body onload="setH('IF1','NIF1'); setH('IF2','NIF2');">

<iframe marginwidth="0" marginheight="0" width="190"  scrolling="no" frameborder ="0" id="IF1" name="NIF1"  src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=1 " > 
</iframe>

<BR><BR>

<iframe marginwidth="0" marginheight="0" width="190" id="IF2" name= "NIF2" scrolling="no" frameborder="0" src=" http://amazoneasyview.com/cgi-bin/play.cgi?locale=us&mode=books&node=1&sort_type=%2Bsalesrank&page_num=2 " >
</iframe>

<BR>


</body>
</html>
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 10973536
If the content is not coming from your domain it is not going to work, because that creates a security violation, and you can't access the element with the external content.  To get around it the content pages would have to set it themselves by doing the body tags as:

<body onload="resizeTo(document.body.scrollWidth, document.body.scrollHeight)">

If you have the capability of modifying the incoming page then that will take care of it, but if you cannot put the code right on the content pages you are out of luck.

Cd&
0
 
LVL 4

Author Comment

by:macuser777
ID: 11216036
Thanks for all the input on the auto resizing - i've been playing with it but no joy. There's a new version of the script coming out soon - maybe it will be possible with that.

macuser
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 11216471
Glad we could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Auto Complete Using JQuery 5 89
error email attachment VB2010 5 48
Magento Indexing 1 103
Questions about this React unit test 4 67
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question