Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    pls help...works fine in IE but not in other browsers...

    Here is the function to change content in multiple frames at once:

    function load_left_main(url_left, url_main){
    parent.fr_left.location.href = url_left; //to the left frame
    parent.fr_main.location.href = url_main; // to the main frame
    return false;
    }


    The hyperlink tag that invokes the function:

    <a href="" tabindex="26" onclick="return load_left_main('eur_ac_contacts.html','../../ententes/eur/ac_contacts.html')">contacts</a>


    This works fine in IE, but for other browsers (firefox, netscape, opera, safari,..), it only loads the content into the "fr_left" frame.

    Is there a way to make this compatible for all browsers ?

    Any solution will be greatly appreciated

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by chinh View Post
    Here is the function to change content in multiple frames at once:

    function load_left_main(url_left, url_main){
    parent.fr_left.location.href = url_left; //to the left frame
    parent.fr_main.location.href = url_main; // to the main frame
    return false;
    }


    The hyperlink tag that invokes the function:

    <a href="" tabindex="26" onclick="return load_left_main('eur_ac_contacts.html','../../ententes/eur/ac_contacts.html')">contacts</a>


    This works fine in IE, but for other browsers (firefox, netscape, opera, safari,..), it only loads the content into the "fr_left" frame.

    Is there a way to make this compatible for all browsers ?

    Any solution will be greatly appreciated
    If as I suspect this code resides in the left frame, try reversing the order of the statements.

  • #3
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Hi chinh,

    The problem lies in your use of the <a> element with its href-attribute. Remember that this elements in itself functions as a link. Setting href="" doesn't prevent this. Instead use a neutral element such as span:
    Code:
    <span onclick="load_left_main('page1.html','page2.html')">contacts</span>
    or if you absoultely need to use an <a> element (e.g. for styling reasons), you must use it with a javascript pseudo-URL (originally invented exactly for this situation) in the href attribute instead of the onclick attribute
    Code:
    <a href="javascript:load_left_main('page1.html','page2.html')">contacts</a>

  • #4
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    the function is in a seperated file called load_frames.js,
    and this is the tag included in every HTML pages:
    <head>
    <script src="../../javascript/load_frames.js" type="text/javascript"></script>
    </head>

  • #5
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by koyama View Post
    Hi chinh,

    The problem lies in your use of the <a> element with its href-attribute. Remember that this elements in itself functions as a link. Setting href="" doesn't prevent this. Instead use a neutral element such as span:
    Code:
    <span onclick="load_left_main('page1.html','page2.html')">contacts</span>
    or if you absoultely need to use an <a> element (e.g. for styling reasons), you must use it with a javascript pseudo-URL (originally invented exactly for this situation) in the href attribute instead of the onclick attribute
    Code:
    <a href="javascript:load_left_main('page1.html','page2.html')">contacts</a>
    Hi Koyama,
    Thanks for the help.
    But it still doesn't work in other browsers.

  • #6
    Senior Coder koyama's Avatar
    Join Date
    Dec 2006
    Location
    Copenhagen, Denmark
    Posts
    1,246
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Then you will need to show us a live example.

    Also, my own test shows that your original version works in FF but not in IE. And this makes sense to me for the reasons I gave you.

    The version I suggested works for me in IE and FF as well. So something else must be wrong. Let's see your live version.

  • #7
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi Koyama,

    The problem is fixed and it's working fine now. The reason is that the "name" property in the fr_main was omitted. I m really sorry for wasting your time for a stupid mistake. I guess I've just overlooked. I guess the project's deadline is really affecting my concentration. I apology for everything.
    Thank you all for your time and patience
    Hope to talk to u again
    Chinh


  •  

    Posting Permissions

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