loading contents of external file into div via iframe

C

crescent_au

Hi all,

I am trying to load contents of external html file into div but I am
not able to do it. However, using onclick to call the same function
works.

My code is attached below. Please read comments on UPPERCASE.

<iframe id="features" name="features" src="products/toys/features.html"
style="display:none;"></iframe>

<span><a href="#" onmouseout="MM_swapImgRestore()"
onmouseover="MM_swapImage('Image35','','images/buttons/rollover/feature_rollover.jpg',1)"><img
src="images/buttons/features.jpg" name="Image35" width="85" height="18"
border="0" id="Image35" onclick="load_text('features')" /></a></span>
<!-- HERE load_text() WORKS -->

<div id="textChange"></div>
<script language="javascript">load_text('features');</script><!-- HERE
load_text() DOESN'T WORK -->

---------------------------
// .js file
function load_text(buf) {
document.getElementById('textChange').innerHTML =
eval('window.frames.'+buf+'.document.body.innerHTML');
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top