|
|
||||||||||||
External Files Within LayersQuestion: Can I display an external HTML file as part of my page? Answer: Yes, you can display an external HTML file on your page by using: LAYER or ILAYER tags with SRC=FILENAME.HTM (in Netscape 4)
IFRAME tag with SRC=FILENAME.HTM (in Explorer 4+ and Netscape 6)
You can use JavaScript to detect the browser name and version (see Client Information) and then generate the necessary IFRAME or
LAYER tags.
Here's an example:
In the above example, we've created a JavaScript function
insertExternalFile("inserted_file.htm",layer_width,layer_height)
The JavaScript code of the function
<script language="JavaScript">
<!--
function insertExternalFile(fname,W,H) {
if (navigator.appName.indexOf("Microsoft")!=-1
|| navigator.appName=="Netscape"
&& parseInt(navigator.appVersion)>4
)
{
document.write(''
+'<IFRAME src="'+fname+'" scrolling="no" frameborder=0 border=0'
+(W==null ? '' : ' width='+W)
+(H==null ? '' : ' height='+H)
+'></IFRAME>'
)
}
if (navigator.appName=="Netscape"
&& parseInt(navigator.appVersion)==4) {
document.write(''
+'<ILAYER>'
+'<LAYER src="'+fname+'" '
+(W==null ? '' : ' width='+W)
+(H==null ? '' : ' height='+H)
+'></LAYER></ILAYER>'
)
}
}
//-->
</script>
Copyright
© 2000, Alexei Kourbatov
|
||||||||||||