Results 1 to 4 of 4

Thread: how to use <frame> in this code?

  1. #1
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default how to use <frame> in this code?

    hello
    how can i use <object> or <frame> instead of iframe in this code?

    <script type="text/javascript">
    {literal}
    function RedirFrames(id1, url1, id2, url2, id3, url3, id4, url4)
    {
    document.getElementById('frame1').src = url1;
    document.getElementById('frame2').src = url2;
    document.getElementById('frame3').src = url3;
    document.getElementById('frame4').src = url4;
    }
    {/literal}
    </script>

    </head>
    <body id="body">

    <center>

    <iframe id='frame1' name="frame1" style="position: absolute; left: 0px; top: 0px;" width="49%" height="49%"></iframe>
    <iframe id='frame2' name="frame2" style="position: absolute; right: 0px; top: 0px;" width="50%" height="49%"></iframe>

    <iframe id='frame3' name="frame3" style="position: absolute; left: 0px; bottom: 0px;" width="49%" height="49%"></iframe>
    <iframe id='frame4' name="frame4" style="position: absolute; right: 0px; bottom: 0px;" width="50%" height="49%"></iframe>
    </center>

  2. #2
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    There are errors on your page. And <object> and <frame> are not suitable for what you want. Why not just use the iframe, which validates in HTML5! This works and validates:
    Code:
    <!DOCTYPE html>
    <html>
    <head>
    <script type="text/javascript">
    function RedirFrames(which_div1, url1, which_div2, url2, which_div3, url3, which_div4, url4)
    {
    document.getElementById(which_div1).src = url1;
    document.getElementById(which_div2).src = url2;
    document.getElementById(which_div3).src = url3;
    document.getElementById(which_div4).src = url4;
    }
    </script>
    
    <title></title>
    </head>
    
    <body><div>
    <a href="javascript: void(0)" onclick="RedirFrames('iframe1', 'http://www.dynamicdrive.com', 'iframe2', 'http://www.webkit.com', 'iframe3', 'http://www.cryer.co.uk/resources/javascript/script8.htm', 'iframe4', 'http://www.cryer.co.uk/resources/javascript/script8.htm#SimpleForms')" >Load iframes</a>
    
    <a href="javascript: void(0)" onclick="RedirFrames('iframe1', '', 'iframe2', '', 'iframe3', '', 'iframe4', '')" >Unload iframes</a>
    
    <div style="position: absolute; left: 30px; top: 30px; right: 51%; bottom: 51%; "><iframe id='iframe1' name="iframe1"  style="position: absolute; width: 100%; height: 100%" ></iframe></div>
    
    <div style="position: absolute; left: 50%; top: 30px; right: 30px; bottom: 51%"><iframe id='iframe2' name="iframe2" style="position: absolute; width: 100%; height: 100%"></iframe></div>
    
    <div style="position: absolute; left: 30px; top: 51%; right: 51%; bottom: 30px"><iframe id='iframe3' name="iframe3" style="position: absolute; width: 100%; height: 100%" ></iframe></div>
    
    <div style="position: absolute; left: 50%; top: 51%; bottom: 30px; right: 30px"><iframe id='iframe4' name="iframe4" style="position: absolute; width: 100%; height: 100%"></iframe></div>
    
    </div></body>
    
    </html>
    Arie Molendijk.

  3. The Following User Says Thank You to molendijk For This Useful Post:

    alipour66m (01-18-2012)

  4. #3
    Join Date
    Jan 2012
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default error

    thanks for your help
    but i dont want to use iframe because google dont like iframes .
    do you have a better solution?
    what should i do?
    Last edited by alipour66m; 01-18-2012 at 03:13 PM.

  5. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    If Google doesn't like iframes, then it will probably not like frames and text/html-objects either. And frames have issues that iframes don't have.
    ===
    Arie.

  6. The Following User Says Thank You to molendijk For This Useful Post:

    alipour66m (01-19-2012)

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
  •