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

Layer

Status
Not open for further replies.

PepperPepsi

Programmer
Aug 3, 2000
241
US
Hi,

I know this doesn't work in NS6 and IE broswer,
<layer src=&quot;data.html&quot;></layer>

is there any other way to do it? i don't work to use IFRAME

thanks Chiu Chan
WebMaster & Software Engineer
emagine solutions, inc
cchan@emagine-solutions.com
 
What problems are you having with the iframe? That's really the only solution I can think of besides a regular frameset...
 
<!-- 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 -->

This should help you out.

Bob
 
>>DoNotEven
yeah, thats eggzactly what i meaned, check it workin at


but there is one little problem:
this stuff doesnt work from first attempt... (actually, my version used2 work from second attemot only...)
i tryed this & that & figured out that usin setTimeout('func()',0) increases chanses that this stuff will work, but it still not 100% of cases (for about 75-80% it works)

i'll check if ur suggestion works fine & let u know...

regards, vic
 
no'p ur code also works from the second attempt (i have 2 click twice on that link for new content 2 appear in needed layer...)

do u know how 2 fix it (not the way i fixed it) ?
 
I modified it somewhat and it works for my drop down menu at Modified = I put the JavaScript part in a js file so I did not have to write the JavaScript in all my files. The JavaScript for my drop down menu is in the same js file. It saves a bunch of typing that way. And then link to it. <SCRIPT LANGUAGE=&quot;JavaScript&quot; SRC=&quot;indexjs.js&quot;></SCRIPT>

When designing web pages I have noticed that the code I am working on right then may not be working right because of an error in another part of the page that I missed. And the error may not even be related to the code I am working on, but yet messes it up. So all I know to tell you is to check for errors in the whole document. Debug it.

Also check the var,s in you JavaScript and make sure your not using the same name for any of them. If you do you may get strange reactions from the script. Trying to use var i; for two different functions may not work, because var i; may be declaried out side of one of the functions. The best is to make sure none of the var's have the same name.

They claim if the var is declaired inside of a function you can use the same var name over, but I leave nothing to confusion I name them all with different names.

Hope I am helping you out.

Bob
 
yeah, u're right, this stuff works!
<body onload=&quot;parent.showPage('contentLayer')&quot;>
in the page that is to be loaded into the main one really solve my problem!
i'm gone modifyin my own scripts!!!

Best regards, vic

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top