Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pass url from one page to another

Status
Not open for further replies.

rhinomac

Programmer
Jan 24, 2003
34
0
0
US
hello,
i am trying to pass a url from one page into another to have it set as the source of the iframe.
here is the url

.......................................................
here is the code i am trying to use on the page that opens (info_frame1)

<script type="text/javascript">

function getQueryStringVars() {

var server_variables = {};
var query_string = window.location.search.split( "?" )[ 1 ];
}

window.onload = function() {

ifr = document.getElementsByTagName( "iframe" )[ 0 ];
ifr.src = getQueryStringVars();
}

</script>
.................................
and the iframe code:
<IFRAME name =

"mainbody"
src = ""
width = "100%"
height = "450"
scrolling = "auto"
frameborder = "1"
align = "middle"
marginwidth = "0"
marginheight = "0"></IFRAME>
Any help would be appreciated,
Rhino
 
Are you trying to pass the Google link part of the URL to another page? I'm not entirely clear.

If so, you can send it across to your info_frame1.php file:

I added "url=" to assign the url to a $_GET variable. And then to access it using PHP and then set it to a variable in JavaScript:
Code:
<?php
$url = $_GET["url"];
print('var theURL = $url;');
?>
If I'm way off, let me know.

Good luck,
Nick

Find the best deals online!
 
How about this? Forgetting about php...
Code:
function getAfterQ()
{
  var arr = location.href.split('?');
  arr.reverse();
  arr.pop();
  arr.reverse();
  return arr.join('?');
}

--Chessbot

"In that blessed region of Four Dimensions, shall we linger on the threshold of the Fifth, and not enter therein? Ah, no! [...] Then, yielding to our intellectual onset, the gates of the Sixth Dimension shall fly open; after that a Seventh, and then an Eighth -- --" Flatland, A. Square (E. A. Abbott)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top