|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
external HTML > Hidden Iframe > Div ???
Its the classic problem that Netscape solved years ago with its elegant
< layer src="file.html"> solution. So cross-browser, is not the problem. I'll do a complete Netscape solution instead, and offer seperate pages based on a bowser sniff. The problem is @#$%^# Microsoft.To get around Microsoft's mingyness I have to load an external file into a hidden Iframe buffer but because Iframe's play merry hell with z-indexes (I have pop-up menus using invisible divs) transfer the contents of the Iframe into a main content div with a z-index of 1. dynamically populating the Iframe with file.html is no problem. but I am having weird problems with getting any content into my div declarations <iframe name="buffer" width="1" height="1"> <div id="content" onClick=goto("file.htm")></div> now, from all I read, this should work: function goto(target) { frames['buffer'].location.href=target; document.all.getElementByID['content"].innerHTML=document.frames["buffer"].document.all.innerHTML } But in MS6, the red bit isn't working. In fact even:document.all.getElementByID["content"].innerHTML="Work, damn you, work!" doesn't work either!! which seems pretty strange.any helpful hints gratefully received!! ![]() |
|
#2
|
||||
|
||||
|
Corrent me if I'm wrong, but the DIV "content" isn't part of the current document (it's a totally separate frame, i.e. document), so you can't reference it using "document.". You must go higher up the DOM.
|
|
#3
|
|||
|
|||
|
How odd, my nickname 'round here is stumpy too!
Thanks for responding but, 'fraid you are wrong. I didn't need to go any further up the Dom at all. No, the trick is you can't do the lot in one step. I only realised it when I accidentally clicked twice and THEN it worked! Thus the need for the second function triggered by onLoad in the buffer iframe. the solution is as follows: <script> function goto(target) { frames['buffer'].location.href=target; } function loadcontent() { content.innerHTML=parent.frames['buffer'].document.body.innerHTML; } </script> ... onMouseDown="goto('someURI') ... <div id='content'> </div> ...and hidden at the bottom of the page... <Iframe name="buffer" onLoad="loadcontent()" height="1" width="1"> works in MSIE 6 anyway! Gosh, coding for Netscape is going to be relatively dull after all that! ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > external HTML > Hidden Iframe > Div ??? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|