Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Need to link to a page and also send info for frame on page???!?!?!
Old 12-05-2005, 11:48 PM Need to link to a page and also send info for frame on page???!?!?!
Novice Talker

Posts: 13
Trades: 0
I have 2 pages. Page 2 has a frame. Page 1 has a link 'go'. When the user clicks go, I need this Go to link to page 2 but also load the frame on page 2. How can I do this? Will a multiple HREF work like with the Javascript:go function?
kyle_davis13 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-06-2005, 12:23 AM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Does the frame (iframe or frameset?) on page 2 not already just point to the location? I'm confused on how you have your pages setup... do you have an example or code?

Edit: ok, I re-read it, so you have 1 page, you click on a link, which opens page 2. Page 2 has an iFrame on it, and you want it when you click on the link on page 1, you can define what link opens on page 2? Here you go:

Page 1 link:
Code:
<a href="page2.html?frame=page3.html">Click me!</a>
Page 2 code:
Code:
<html>
<head>
<script>

	function geturlArguments() { 
		var params = new Array(); 
		if (location.search) { 
			var pairs = location.search.substring(1, location.search.length).split("&"); 
			for (var i=0; i<pairs.length; i++) { 
				nameVal = pairs[i].split("="); 
				params[i] = nameVal[1]; 
				params[nameVal[0]] = nameVal[1]; 
			} 
		} 
		return params;
	}
	
function loadframe() {
	var get = geturlArguments();
	document.getElementById("myFrame").src = get["frame"];
}

</script>
</head>

<body onload="loadframe();">
Here is my Frame:
<iframe width="500" height="400" id="myFrame" style="border: 2px black solid">
You have no Frames Support!
</iframe>
</body>
</html>
The JS code will grab the url from the querystring and set the src of the iframe to it. You dig?

Last edited by funkdaddu; 12-06-2005 at 12:36 AM..
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 12-06-2005, 12:39 AM
Novice Talker

Posts: 13
Trades: 0
wow great!! thanks so much!
kyle_davis13 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Need to link to a page and also send info for frame on page???!?!?!
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.16653 seconds with 12 queries