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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Layering malarkey.. 1

Status
Not open for further replies.

QuietDean

Instructor
Mar 10, 2001
163
GB
Im no expert on layering et al. but I have been playing with it today.

Unfortunately, all the sources I consult (inc. internet and books) are very contradictory.

My aim is to 'include' another page in another (without using ssi or php). Also, the 'source' page has to be an ssi, therefore I cannot use js include.
Could someone give me some Netscape friendy snippets of code to achieve this? ( I am using iframe for the Explorer version )

Whilst I am thinking of using <ilayer> and <layer>, I am open to suggestions along other lines, too. ( like, whats this innerHTML I am always hearing about? )

Gratitude in advance, Dean Owen
 
The following code works great:

<!-- An online tutorial can be found at -->

<!-- THREE STEPS TO INSTALL LOAD HTML:

1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document you will be loading -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<!-- Original: Eddie Traversa (psych3@primus.com.au) -->
<!-- Web Site: -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! -->

<!-- Begin
var nn4 = (document.layers);
var nn6 = (document.getElementById && !document.all);
var ie4 = (document.all && !document.getElementById);
var ie5 = (document.all && document.getElementById);
function loadPage(id,nestref,url) {
if (nn4) {
var lyr = (nestref)? eval('document.'+nestref+'.document.'+id) : document.layers[id]
lyr.load(url,lyr.clip.width)
}
else if(ie4) parent.contentFRM.location = url;
else if(ie5 || nn6) document.getElementById('contentFRM').src = url;
}
function showPage(id) {
if (ie4) {
document.all[id].innerHTML = parent.contentFRM.document.body.innerHTML;
}
else if(nn6 || ie5) {
document.getElementById(id).innerHTML = window.frames['contentFRM'].document.getElementById('theBody').innerHTML;
}
}
// End -->
</script>

</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag -->

<BODY onload=&quot;parent.showPage('contentLayer')&quot;>

<!-- STEP THREE: Copy this code into the BODY of your HTML document you will be loading -->

<a href=&quot;javascript:loadPage('contentLayer',null,'load-html-demo.html')&quot;>Load Page</a>
<iframe name=&quot;contentFRM&quot; id=&quot;contentFRM&quot; width=&quot;0&quot; height=&quot;0&quot; frameborder=&quot;0&quot;>
</iframe>
<div id=&quot;contentLayer&quot; style=&quot;position:absolute; width:345px; height:115px; z-index:1; left: 186px; top: 304px&quot;></div>

<p><center>
<font face=&quot;arial, helvetica&quot; size&quot;-2&quot;>Free JavaScripts provided<br>
by <a href=&quot; JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.98 KB -->

I use it for my menu.
Play around with this and modify it to work like you want, I did.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top