1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Load content in iframe from a javascript form

Discussion in 'JavaScript' started by redrum, Dec 7, 2007.

  1. #1
    I have a form where I want to load the content after submiting into an iframe

    Javascript:
    
    <script> 
    function go(){ 
    var L1 = document.theform.list1.value; 
    
    if (L1!= "#") 
    { 
    var url = "http://www.url.com/" + L1 + ".html";  
    { window.location = url; return false; }
    } 
    } 
    </script> 
    
    HTML:
    The form:
    
    <form name="theform"> 
    <input name="list1" type="text" style="background-color:#ffffff; color: #666666; width: 160px;" size="20"> 
    <input type="button" value="GO" onclick="go()"/>   
    </form> 
    
    HTML:
    The iframe:
    <iframe name="lastframe" id="lastframe" SRC="lastframe.html" width="200" height="100" frameborder="0" marginwidth="0" marginheight="0" ></iframe>
    HTML:
    How can I get this content target into an iframe?

    Thanks,
    Fredrik
     
    redrum, Dec 7, 2007 IP
  2. redrum

    redrum Peon

    Messages:
    18
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hey it looks like I solved it. I changed
    { window.location = url; return false; }
    HTML:
    to
    document.getElementById("lastframe").src = url;
    HTML:
     
    redrum, Dec 7, 2007 IP