
tom
Staff

Oct 3, 2011, 10:18 AM
Post #2 of 3
(21170 views)
Shortcut
|
Hello MickC, We moved this to the off-topic section as it's not directly related to CMS Builder. Generally we don't provide support for non-CMS Builder issues, but here's a start point for you :-) As I understand it, you're not using php and you want to link from (a product) within an iframe to a new page which will, in another iframe, display the details (of the product). For the first part, creating the links that will link to another page and pass the information about what product has been clicked:
<a href='displayDetailsInIframe.html?pageLink=thePageYouWant.html' target="_blank">Here's a link</a> The link just has a variable added (pageLink) with a value (the name of the page). I should also mention that target='_blank' will open a new window, not reload the current one (use target='_parent' to do that) On the receiving page, add the following javascript to the top of the page (or, if you have a .js linked in your header, add it to that):
function gup( name ) { name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); var regexS = "[\\?&]"+name+"=([^&#]*)"; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return ""; else return results[1]; } This function (found at netlobo http://www.netlobo.com/url_query_string_javascript.html) when called parses the url and finds the requested variable (in this case, pageLink) and returns its value. Then, in the body of your page when loading the iframe, insert the following in place of the usual <iframe .. > opening tag:
<script type="text/javascript"> var pageLink = gup("pageLink"); document.write( "<iframe src='"+pageLink+"'"+">"); </script> This will create the tag with the page you have requested loaded within it. Hope that makes sense, Tom
(This post was edited by tom on Oct 3, 2011, 10:19 AM)
|