First of all, I am not all that thrilled with the Iframe SSI script II script because it doesn't work in many browsers and cannot work even in IE and FF in certain layouts. And, in any browser without javascript enabled, shows no iframe. But, if you are happy with it, you can pass a parameter as a query with an ordinary link:
Code:
<a href="index.html?product=02">Link Text or Image</a>
Then, add this function at the top of the script:
Code:
function get(key_str) {
var query = window.location.search.substr(1);
var pairs = query.split("&");
for(var i = 0; i < pairs.length; i++) {
var pair = pairs[i].split("=");
if(unescape(pair[0]) == key_str)
return unescape(pair[1]);
}
return null;
}
Add this code to function resizeCaller() of the script:
Code:
function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
if(get('product'))
loadintoIframe('myframe', 'products/product'+get('product')+'.html')
}
Or, instead of modifying resizeCaller(), you could replace this (your version of it):
Code:
<iframe id="myframe" src="externalpage.htm" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>
with something like this:
Code:
<script type="text/javascript">
var the_product_page=get('product')? "products/product'+get('product')+"html" : "products.html";
document.write('<iframe id="myframe" src="'+the_product_page+'" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>');
</script>
This would load the chosen content as the page loads as opposed to after the page has loaded.
Bookmarks