PDA

View Full Version : Passing Variables to Form Pages


jwoods7
06-22-2002, 09:14 PM
Does anybody know of a technique to pass variables to frame pages using javascript?

I can use window.location.search to retrieve a variable from a normal page.

I'm going for the effect of when a user clicks on a link, it opens a frame window with my navigation bar on the top and the new page on bottom.

The problem is that I want to specify which page loads in the bottom in the link to the frame page.

For example:

<a href="/framesetpage.html?link=http://mysite.com">View this site</a>
<a href="/framesetpage.html?link=http://yoursite.com">View your site</a>

Then it loads a frame page with the nav page at the top, and whatever page was clicked on below...

joh6nn
06-22-2002, 09:29 PM
yeah, i think i know what you want.

you use links the way you've got them set up now, and your frameset page looks like this.

<script>
function lode() {
var temp = "";
if (window.location.search) {
temp = window.location.search.slice(1);
}

self.frames['bottomFrame'].location = temp;
}

self.onload = lode;
</script>

jwoods7
06-22-2002, 09:37 PM
What am I doing wrong on this?

I'm calling the page "outside.html" and referencing it using <a href="outside.html?temp=http://www.mysite.com">Link is here</a>


The source of "outside.html" looks like:

<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<frameset ROWS="108,*" >
<frame NAME="A" SRC="framenav.html" NORESIZE="yes" SCROLLING="no">
<frame NAME="B" SRC="framemain.html">
</frameset>
</head>
<body>

<script>
function lode() {
var temp = "";
if (window.location.search) {
temp = window.location.search.slice(1);
}

self.frames['B'].location = temp;
}

self.onload = lode;
</script>

</body>
</html>

joh6nn
06-22-2002, 09:39 PM
<a href="outside.html?temp=http://www.mysite.com">Link is here</a>

get rid of the part in bold, and it should work.

jwoods7
06-22-2002, 09:45 PM
Hmmm...

No errors show up but it never redirects to the new page. Just shows framemain.html in the lower frame.

joh6nn
06-23-2002, 01:58 PM
can i see a link to the page this is on?

redhead
06-23-2002, 02:55 PM
I think Dave Clark has a script that does something like this... I remember seeing it in the old forum...

jwoods7
06-24-2002, 04:36 PM
Okay...

after copying the code directly it came up with an error:
'window.top.frames.pageb has no properties.'

I changed this line:
<frame name="cartfmainwindow" scrolling="yes">

to this:
<frame name="cartfmainwindow" scrolling="yes" src="framemain.html">

and it worked! No clue why but I'm glad it does!

Thanks for the help,

- J