...

View Full Version : pls help...works fine in IE but not in other browsers...



chinh
12-18-2006, 11:11 PM
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

Arty Effem
12-18-2006, 11:39 PM
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 appreciatedIf as I suspect this code resides in the left frame, try reversing the order of the statements.

koyama
12-18-2006, 11:40 PM
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:


<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


<a href="javascript:load_left_main('page1.html','page2.html')">contacts</a>

chinh
12-18-2006, 11:41 PM
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>

chinh
12-18-2006, 11:57 PM
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:


<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


<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.

koyama
12-19-2006, 12:14 AM
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.:)

chinh
12-19-2006, 12:34 AM
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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum