JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old March 10th, 2004, 09:06 PM
kiwipete kiwipete is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Wellington, NZ
Posts: 2 kiwipete User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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!!

Reply With Quote
  #2  
Old March 11th, 2004, 05:24 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 6 m 11 sec
Reputation Power: 8
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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.
__________________
DevArticles Moderator
BlueSix - Web Development and Consulting

Reply With Quote
  #3  
Old March 11th, 2004, 05:06 PM
kiwipete kiwipete is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Location: Wellington, NZ
Posts: 2 kiwipete User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb solved!

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!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > external HTML > Hidden Iframe > Div ???


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway