Welcome to WebmasterWorld Guest from 54.234.114.182

Forum Moderators: incrediBILL

Message Too Old, No Replies

Trouble with iframes and Javascript

     
7:49 pm on Jun 10, 2004 (gmt 0)

New User

10+ Year Member

joined:June 10, 2004
posts:30
votes: 0


I am attempting to do something that I hope is not impossible. I have an html calendar on my site. I want each day on the calendar to be clickable so that information about that day opens up in an iframe below the calendar. I had no problem with this until I added a javascript to the main document. This script is designed to detect the current date and display a certain html file in the iframe upon arrival at the calendar page. For some reason, since I have added the javascript, although the correct information pops up in the iframe automatically, whenever I try to click on a different date in the calendar to load new info in the iframe, it opens in a new window. I really need it to open in the iframe. In addition, I need this to work in Netscape 4.79, so ideally the content would also be loadable in a layer. I would also be open to substituting layers for the iframe altogether.

Does anyone know what I could be doing wrong?

Thanks in advance!

Amanda

8:15 pm on June 10, 2004 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Jan 15, 2004
posts:1300
votes: 0


Are you targetting the iframe correctly in the links?

You can embed the layer in the iframe, like this:

<a href="yourfile2.htm" target="content">your file 2</a>
<iframe src="yourfile.htm" name="content">
<ilayer src="yourfile.htm" name="content"></ilayer>
</iframe>

or something to that affect, I've never used ilayer tags so I'm not really up on them, but that's how it would work in theory.

If this is supposed to work in Netscape 4x browsers, then you can't use javascript's getElementById() to change the content, you have to change the location src of the iframe.