PDA

View Full Version : File reading and pointing file contents to div or iframe


Dalsor
07-15-2002, 05:54 AM
Greetings. I'm having a small problem with trying to read the contents of an auto-generated .html file which I'm trying to pass to a div when a user clicks a link. If anyone can offer suggestion to make this work, it would be greatly appreciated. Here's what I have.


<script>
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false

function loadOnline(page) {
if (ns4) document.mainContent.src = page
else if (ie4) parent.mainContent.document.location = page
}
</script>

<a href="javascript:loadOnline('online.html');" onMouseover = "window.status='Who\'s online at AWW';return true">
Who's Playing

<div ID="mainContent">
<IFRAME name="mainContent" src="online.html" STYLE="display:none"
SCROLLING="No" WIDTH="300" HEIGHT="200" MARGINWIDTH=0 MARGINHEIGHT=0 FRAMEBORDER="No">
</iframe>
</div>


Pardon the formatting... Looks like a couple of spaces have been auto-inserted.

premshree
07-15-2002, 07:04 AM
You cannot read external HTML files using JavaScript and then pass it on to a <DIV>...........you need server-side OR you could do with client-side JavaScript and XML........though not all browsers will support it.

Some related links :
http://www.dynamicdrive.com/dynamicindex2/xmlticker.htm
http://www.xs4all.nl/~ppk/js/importxml.html
http://www.webfx.eae.net/dhtml/xmlextras/xmlextras.html

:thumbsup: