Martin Cotterill
asked on
Pass Variables to another page
Hello everybody
What I want to do is to pass data contained in a script to another page and use the retrieved data to display content on the other page.
ie:
thisPage.html
<html>
<head>
<script>
function pants(pic, picname, picdesc, price) {
...
(What code do I put here to send the data to theOtherPage.html?)
...
}
</script>
</head>
...
...
</html>
-------------
theOtherPage.html
<html>
<head>
...
...
What do I put here to display the data retrieved from thisPage.html
...
...
</html>
I hope this makes sense.
Many thanks in advance.
Pantyboy
What I want to do is to pass data contained in a script to another page and use the retrieved data to display content on the other page.
ie:
thisPage.html
<html>
<head>
<script>
function pants(pic, picname, picdesc, price) {
...
(What code do I put here to send the data to theOtherPage.html?)
...
}
</script>
</head>
...
...
</html>
-------------
theOtherPage.html
<html>
<head>
...
...
What do I put here to display the data retrieved from thisPage.html
...
...
</html>
I hope this makes sense.
Many thanks in advance.
Pantyboy
There are several different ways to do it, but it depends on certain factors. Is thisPage.html a child or parent window of theOtherPage.html? Or does thisPage.html link to theOtherPage.html?
ASKER
Hi there
I'm sorry, I should have added that thisPage.html would have links attached to thumbnails and set out as <a href="javascript:void(0)" onclick="pants('woman-read ing.jpg',' Woman Reading','20 x 30 Acrylic on Canvas','£50')">View Larger Image</a>.
When the link is clicked, theOtherPage.html would be loaded with the data retrived from pants(...) written and displayed in it.
I know that a page can be written on the fly and I am using this method at the moment, but I have thisPage.html loaded into an <iframe> that resizes depending on the page content. However the 'on-the-fly' created page doesn't resize the <iframe> no matter how hard I try.
So, to kill two birds with one stone so to speak, parsing the data to an another html file would resize the <iframe> when the new page is loaded and be easier to make alterations to, if needed.
Pantyboy
I'm sorry, I should have added that thisPage.html would have links attached to thumbnails and set out as <a href="javascript:void(0)" onclick="pants('woman-read
When the link is clicked, theOtherPage.html would be loaded with the data retrived from pants(...) written and displayed in it.
I know that a page can be written on the fly and I am using this method at the moment, but I have thisPage.html loaded into an <iframe> that resizes depending on the page content. However the 'on-the-fly' created page doesn't resize the <iframe> no matter how hard I try.
So, to kill two birds with one stone so to speak, parsing the data to an another html file would resize the <iframe> when the new page is loaded and be easier to make alterations to, if needed.
Pantyboy
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
minor typo: ``view a <strong>woman reading</strong>''
ASKER
Hi ren_b
This works. However, just a couple of questions.
1. Can I alter the document.writeln() statement to document.write() so that the page can be laid out differently?
2. Can I use the data retrieved in pants[1] as the document title?
Pantyboy
This works. However, just a couple of questions.
1. Can I alter the document.writeln() statement to document.write() so that the page can be laid out differently?
2. Can I use the data retrieved in pants[1] as the document title?
Pantyboy
1. ya you can change the document.writeln to whatever you want, that was just an example.
2. document.title = pants[1]
2. document.title = pants[1]
ASKER
Hi ren_b
Thanks for the help. This solves m' problem.
Big up
Pantyboy :)
Thanks for the help. This solves m' problem.
Big up
Pantyboy :)