onClick iframe assistance for beginner

Discussion in 'JavaScript' started by d360, Apr 23, 2007.

  1. #1
    Hi all, I hope someone can help me finalize this project.

    Here's the site I'm working on: Link

    The top half of the page (flash panorama + copy) is an iframe, the bottom is a tab interface which allows you to click around independently of the iframe. Links from the map load in the iframe above (iframe name="pano").

    However, our client would prefer that when you click on a tab, a new panorama from that new mountain will load above.

    I've been in contact with the developer of the tab interface, and he says it's possible to do this with an onClick event and supplied me with this example code:
    function(argsObj) {
    
        var t = argsObj.tabber; /* Tabber object */
        var id = t.id; /* ID of the main tabber DIV */
        var i = argsObj.index; /* Which tab was clicked (0 is the first tab) */
        var e = argsObj.event; /* Event object */
    
    var iframe = document.getElementById('myiframeid');
    
    switch (i) {
          case 0:
             iframe.src = 'url for iframe';
             break;
          case 1:
             iframe.src = 'url for iframe';
             break;
          case 2:
             iframe.src = 'url for iframe';
             break;
      }
    }
    
    Code (markup):
    Unfortunately, I'm not sure how to implement that (where to put what, what to change, etc)...caue I'm a beginner and I suck ;) For instance, if I put that code in the <head> section (where I *assume* it goes), what do I put for the <a> on each tab? If anyone can show me what to do I'd be very appreciative.

    Thanks for any help y'all can provide.
     
    d360, Apr 23, 2007 IP
  2. bibel

    bibel Active Member

    Messages:
    289
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    58
    #2
    bibel, Apr 25, 2007 IP