Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: iframe and submit button

  1. #11
    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

    Code:
    window.frames[0].location.href = "www.google.com";
    - John
    ________________________

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

  2. #12
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I know that works. I was just wondering why
    Code:
    window.frames[0].location = "www.google.com";
    didn't, since String seems to be castable to whatever object window.location is.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #13
    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

    Mike!

    He'd know if anyone would. Probably the:

    window.location="string"

    Is a sort of illegal shorthand that all browsers allow. When it is applied to an object other than the window itself though, strict rules apply.
    - John
    ________________________

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

  4. #14
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Hm, perhaps, but that seems a lot less simplistic to me than simply allowing the location object to be cast to and from (or whatever the correct term is in a loosely-typed language) a string.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #15
    Join Date
    May 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Wink wow

    thanx guys for your comments , but i've got to work like so
    Code:
    <html>
    <head>
    <title>testing,,</title>
    </head>
    <body>
    <script language=JavaScript src="test.js" type=text/javascript></script>
    <div align="center">
    <form name="searchForm1" action="" onSubmit="javascript:engine1(this.engine.options[this.engine.selectedIndex].value,this.go.value); return false;">
    <select name="engine" class="drop_down">
    <option value="-1" selected>Select a search engine</option>
    <option value="1" >Google</option>
    <option value="2">yahoo</option>
    </select>
    <input name="go" class="text_field" size="20" maxlength="35" />
    <input name="submit" type="submit" class="search_button" value="Search" />
    </form>
    </div>
    <iframe id="inpage" style="width:600px;height:400px" src="http://www.google.com"></iframe>
    
    </body>
    </html>
    Code:
    function doSearch( selectedIndex, searchTerm ) {
       if ( selectedIndex < 0 ) {
          alert("Please select a search engine!");
          return false;
       } else if ( searchTerm == "" ) {
          alert("No search term!");
          return false;
       }
    DoTheSearchInTheFrame(SEARCH_DATA[selectedIndex][1], SEARCH_DATA[selectedIndex][0]);
    }
    
    function engine1( selectedIndex, searchTerm )
    {
       SEARCH_DATA= new Array(73);
       <!--SEARCH_DATA[value]= new Array( window name , url ) -->
       SEARCH_DATA[1]= new Array("google","http://www.google.fr/search?hl=fr&q="+escape(searchTerm)+"&btnG=Recherche+Google&meta=");
       SEARCH_DATA[2]= new Array("yahoo","http://search.yahoo.com/search?p="+escape(searchTerm)+"&sm=Yahoo%21+Search&fr=FP-tab-web-t&toggle=1&cop=&ei=UTF-8");
    
    doSearch( selectedIndex, searchTerm );
       return true;
    }
    
    function DoTheSearchInTheFrame(var_a,var_b)
    {
    eval("document.getElementById('inpage').src=var_a");
    }

  6. #16
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Sorry... what's the point of that eval() call?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #17
    Join Date
    May 2006
    Posts
    20
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool

    Quote Originally Posted by Twey
    Sorry... what's the point of that eval() call?
    i honestly dont know it couldnt be calling my house for all i know , see im a complete noob.. i've had help from a guy called GBS over @ the phpfreaks forum. http://www.phpfreaks.com/forums/inde...howtopic=92509

  8. #18
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    2,581
    Thanks
    13
    Thanked 28 Times in 28 Posts

    Default

    Huh? All that's been said is VERY confusing. I prefer to do it like this: (i'm prepared to be corrected )
    Code:
    <html>
    <head>
    </head>
    <body>
    <form>
    <input type="button" value="Mamma.com" onclick="inline.window.location.href='http://www.mamma.com'">
    <br><iframe id="inline"></iframe>
    </form>
    </body>
    </html>
    - Mike

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
  •