SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict mcrumlish's Avatar
    Join Date
    Jan 2002
    Posts
    384
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Breaking out of an iframe with a dropdown list

    Hi,

    I have a problem with a dropdown list of links and an iframe.

    Firslty, i have a page with an iframe at the top. This iframe has a dropdown list with each list item acting as a link which automatically loads when the list item is selected. The problem I have is, the links are loading in the iframe but I want them to break out of the iframe and just load in a normal page as they would with target="_parent" or target="_top" in HTML.

    This javascript was written by someone else who worked here and I am not sure how it works. I know it generates the list elements using our backend stuff which I dont need to go into.

    Code:
    function do_menu_data(which_form) {
     
      var str_go_to = eval("document.form" + which_form + ".select1.options[document.form" + which_form + ".select1.selectedIndex].value");
     
      var str_start = str_go_to.charAt(0);
     
      if (str_start == "t") {
     
       str_go_to = str_go_to.substr(1);
     
       var ids = str_go_to.split(",");
     
       document.form1.action.value = "show_type_by_main_market";
       document.form1.ev_type_id.value = ids[0];
       document.form1.ev_class_id.value = ids[1];
     
       document.form1.submit();
     
      } else if (str_start == "c") {
     
       str_go_to = str_go_to.substr(1);
     
       var ids = str_go_to.split(",");
     
       document.form1.action.value = "GoCoupons";
       document.form1.coupon_id.value = ids[0];
       document.form1.ev_class_id.value = ids[1];
     
       document.form1.submit(); 
     
    
         }
     
    }
    basically, i just need to someone to help me with working out what I need to add to the above code to make it break out of an iframe.

    Thanks in advance,
    Martin

  2. #2
    Web-coding NINJA! silver trophy beetle's Avatar
    Join Date
    Jul 2002
    Location
    Dallas, TX
    Posts
    2,900
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Looks like it works of an existing HTML form

    <form target="_parent">
    ...
    </form>

    Or whatever target you like
    beetle a.k.a. Peter Bailey
    blogs: php | prophp | security | design | zen | software
    refs: dhtml | gecko | prototype | phpdocs | unicode | charsets
    tools: ide | ftp | regex | ffdev





Bookmarks

Posting Permissions

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