Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-22-2002, 09:14 PM   PM User | #1
jwoods7
New Coder

 
Join Date: Jun 2002
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
jwoods7 is an unknown quantity at this point
Passing Variables to Form Pages

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...
jwoods7 is offline   Reply With Quote
Old 06-22-2002, 09:29 PM   PM User | #2
joh6nn
wei wu wei


 
joh6nn's Avatar
 
Join Date: Jun 2002
Location: 72° W. 48' 57" , 41° N. 32' 04"
Posts: 1,887
Thanks: 0
Thanked 1 Time in 1 Post
joh6nn is an unknown quantity at this point
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>
__________________
bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

i am a loser geek, crazy with an evil streak,
yes i do believe there is a violent thing inside of me.
joh6nn is offline   Reply With Quote
Old 06-22-2002, 09:37 PM   PM User | #3
jwoods7
New Coder

 
Join Date: Jun 2002
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
jwoods7 is an unknown quantity at this point
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>
jwoods7 is offline   Reply With Quote
Old 06-22-2002, 09:39 PM   PM User | #4
joh6nn
wei wu wei


 
joh6nn's Avatar
 
Join Date: Jun 2002
Location: 72° W. 48' 57" , 41° N. 32' 04"
Posts: 1,887
Thanks: 0
Thanked 1 Time in 1 Post
joh6nn is an unknown quantity at this point
<a href="outside.html?temp=http://www.mysite.com">Link is here</a>

get rid of the part in bold, and it should work.
__________________
bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

i am a loser geek, crazy with an evil streak,
yes i do believe there is a violent thing inside of me.
joh6nn is offline   Reply With Quote
Old 06-22-2002, 09:45 PM   PM User | #5
jwoods7
New Coder

 
Join Date: Jun 2002
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
jwoods7 is an unknown quantity at this point
Hmmm...

No errors show up but it never redirects to the new page. Just shows framemain.html in the lower frame.
jwoods7 is offline   Reply With Quote
Old 06-23-2002, 01:58 PM   PM User | #6
joh6nn
wei wu wei


 
joh6nn's Avatar
 
Join Date: Jun 2002
Location: 72° W. 48' 57" , 41° N. 32' 04"
Posts: 1,887
Thanks: 0
Thanked 1 Time in 1 Post
joh6nn is an unknown quantity at this point
can i see a link to the page this is on?
__________________
bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

i am a loser geek, crazy with an evil streak,
yes i do believe there is a violent thing inside of me.
joh6nn is offline   Reply With Quote
Old 06-23-2002, 02:55 PM   PM User | #7
redhead
Regular Coder

 
Join Date: Jun 2002
Location: United Kingdom Confused: Often
Posts: 859
Thanks: 0
Thanked 0 Times in 0 Posts
redhead is an unknown quantity at this point
Hmm...

I think Dave Clark has a script that does something like this... I remember seeing it in the old forum...
__________________
redhead
redhead is offline   Reply With Quote
Old 06-24-2002, 04:36 PM   PM User | #8
jwoods7
New Coder

 
Join Date: Jun 2002
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
jwoods7 is an unknown quantity at this point
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
jwoods7 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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 +1. The time now is 03:50 AM.


Advertisement
Log in to turn off these ads.