Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Conflicting JavaScript and iframe?



    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?

    Here's the link:
    http://www25.brinkster.com/oo7girl/vimy/june.html

    Thanks in advance!

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    You had a mismatch quotes in the name attribute

    <iframe src="" id="todayInH" name="todayInH'

    And you need <ilayer> for NS4 not <layer>. That is the counterpart of <iframe> in NS4.

    Here's the modified code:
    Code:
    ...
    function insertSrc(){ 
      if(document.layers){ 
        document.layers['todayInH_NS'].src=adr;
      } 
      else{ 
        document.getElementById('todayInH').src=adr; 
      } 
    } 
    
    function setILayer(link){
      if (document.layers){
        document.layers[link.target+'_NS'].src=link.href;
        return false;
      }
      return true;
    }
    ...
    <a href="0630eng.html" target="todayInH" onclick="return setILayer(this)">
    ...
    <ilayer name="todayInH_NS" width="400px" height="500px">
    </ilayer> 
    
    <iframe src="" id="todayInH" name="todayInH" frameborder="0" scrolling="no" 
    width="400px" height="500px"></iframe>
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    32
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You have no idea how much you've just helped me! Thank you so much....careless coding on my part


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •