Results 1 to 3 of 3

Thread: iframe in internet explorer not working

  1. #1
    Join Date
    Apr 2007
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default iframe in internet explorer not working

    Hi,

    I have an iframe that loads multiple pages depending on what the user types into a text box. It works fine in firefox, but not in internet explorer(6 and 7)

    Here is the javascript code:

    window.onload = function () {
    if(document.forms["searchbox_006388034472510427843il-s7xg5oy"].q.value.toLowerCase() == "google"){
    window.open("http://www.google.com", "site")}

    Here is the iframe:

    <iframe src="http://www.yahoo.com" width="95%" height="95%" align="top" name="site" id="site"></iframe>


    Does anyone see a problem...I don't. Is it a problem with iexplorer? Maybe there is some kind of script I can use for people with browsers other than Firefox.

    Thanks in advance to anyone that can help.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Should be:

    Code:
    window.onload = function () {
    if(document.forms["searchbox_006388034472510427843:pil-s7xg5oy"].q.value.toLowerCase() == "google"){
    window.open("http://www.google.com", "site")}
    }
    And, you don't need the id for the iframe tag, name is sufficient:

    HTML Code:
    <iframe src="http://www.yahoo.com" width="95%" height="95%" align="top" name="site"></iframe>
    Your form should look something like so (names, not id's should be used):

    HTML Code:
    <form action="#" name="searchbox_006388034472510427843:pil-s7xg5oy">
    <input type="text" name="q" value="Google">
    </form>
    If all that checks out, the only thing that I can think of is that:

    Code:
    document.forms["searchbox_006388034472510427843:pil-s7xg5oy"].q.value.toLowerCase() == "google"
    tests as false for some reason but, that has nothing to do with the code you have shown.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2007
    Posts
    40
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Thanks

    for helping me.

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
  •