Go Back   Internet Business Forums > Design & Development

Reply
 
Thread Tools Display Modes
Old 21-11-2006, 08:52 PM   #1 (permalink)
co-admin
 
army's Avatar
 
Join Date: Oct 2006
Location: Belgium
Posts: 666
Default [ SCRIPT ] Load an external HTML page in your current page (without frames)

Tutorial Name: Simple match calculator

Description: This script load an external html file into a css layer. It is NS6 compatible as well as supporting IE4+ and NS4.

Author: !i! Army !i!

Difficulty: Intermediate

Details:



<!-- 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 -->

[HTML]
<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- 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>
[/HTML]

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

[HTML]
<BODY onload="parent.showPage('contentLayer')">
[/HTML]

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

[HTML]
<a href="javascript:loadPage('contentLayer',null,'loa d-html-demo.html')">Load Page</a>
<iframe name="contentFRM" id="contentFRM" width="0" height="0" frameborder="0">
</iframe>
<div id="contentLayer" style="position:absolute; width:345px; height:115px; z-index:1; left: 186px; top: 304px"></div>
[/HTML]
army is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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


All times are GMT +1. The time now is 01:11 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.