943,645 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 2010
  • ASP RSS
Feb 26th, 2009
0

url variables, iframes, and ???

Expand Post »
This is boggling my mind right now.

Here's what a client wants:

On the index page, there is an iframe with links inside it. When you click on a link, it opens the page (not in the iframe, but in the top level) and sends a url string variable. This 2nd page (or details page) also contains an iframe that has dynamic content inside of it that needs to be displayed based on which link was clicked from the index page's iframe.

How do I get the variable from the url string to be available for use inside the iframe of the second page?
Similar Threads
Reputation Points: 10
Solved Threads: 1
Newbie Poster
dlacloche is offline Offline
15 posts
since Aug 2008
Feb 26th, 2009
0

Re: url variables, iframes, and ???

What you have there is a very unique problem. I can not think of a reason anyone would want to do that. You could probably acheive this effect with some Java script.
Reputation Points: 14
Solved Threads: 2
Light Poster
efaith77 is offline Offline
25 posts
since Sep 2006
Feb 27th, 2009
0

Re: url variables, iframes, and ???

I can do it in php => implies there is a method in ASP
but why an iframe
an include menu is more compliant with more browser types that dont support iframes
any how

in the iframe menu
html Syntax (Toggle Plain Text)
  1. <a href='/index.php?something=value1' target='_top'>page1</a>
  2. <a href='/index.php?something=value2' target='_top'>page2</a>
  3. <a href='/index.php?something=value3' target='_top'>page3</a>
  4. <a href='/index.php?something=value4' target='_top'>page4</a>
  5. <a href='/index.php?something=value5' target='_top'>page5</a>
  6. <a href='/index.php?something=value6' target='_top'>page6</a>

index.php page
php Syntax (Toggle Plain Text)
  1. <!doctype blah bla>
  2. <html blah bla>
  3. <head>
  4. bla bla
  5. </head>
  6. <body>bla bla
  7. <iframe src="<?php echo $something; ?>" width='bigenough' height='tallenough' frameborder='0'>iframe</iframe>
  8. </body></html>
cant guarantee the syntax for ASP but there must be an analog
Last edited by almostbob; Feb 27th, 2009 at 1:11 am.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Feb 28th, 2009
0

Re: url variables, iframes, and ???

Ok, this isn't really hard. You just need javascript. Of course navigation with JavaScript is almost never a good idea, but here is how.

I'm assuming you have a page called index.asp. index.asp has an iframe called iframe_index.asp. We will link to a page called target.asp with an iframe called target_iframe.asp.

So first your javascript. In the head of your index.asp put:
ASP Syntax (Toggle Plain Text)
  1. function nav(target){<blockquote>window.location='target.asp?param='+target;</blockquote>}

Ok, so this javascript function navigates to target.asp with a dynamic param querystring.

On our iframe_index.asp we have the following links:
ASP Syntax (Toggle Plain Text)
  1. <a href="javascript:window.top.nav(1)">link1</a>
  2. <a href="javascript:window.top.nav(2)">link2</a>
  3. <a href="javascript:window.top.nav(3)">link3</a>

This code calls the nav function on our index.asp page and redirects us to target.asp

Target.asp uses the following iframe:
ASP Syntax (Toggle Plain Text)
  1. <iframe src="target_iframe.asp?param=<%=request.querystring("param")%>"></iframe>

Now, in your target_iframe.asp code, you can do another request.querystring("param") to get the value passed from the iframe_index.asp page and do whatever with it.

DISCLAIMER:
Your iframes must reside on the same domain and server in order for this to work, and you may have some cross-browser issues. I don't recommend using this, but this is how you can do it. You could use sessions and ajax and a few other methods as well.

Cheers.
Reputation Points: 37
Solved Threads: 18
Junior Poster
agrothe is offline Offline
151 posts
since Jun 2006
Mar 4th, 2009
0

Re: url variables, iframes, and ???

Okay. Cool. Thanks for all the help. I'm going to read thru this thread a few times then give it a try!
Reputation Points: 10
Solved Threads: 1
Newbie Poster
dlacloche is offline Offline
15 posts
since Aug 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: problem with command object
Next Thread in ASP Forum Timeline: Upload a EXcel Sheet





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC