Log in

View Full Version : Firefox IFrame Problem



mcg
03-05-2007, 09:59 AM
:)hi ,

I use javascript in a site I build and I have an IFrame and a navigation bar in my index.asp page. when user click on the bar I call the same page and use document.getElementById to get the IFrame and to change it's src, so far so good - if you use IE, if you use firefox the story is different - if you click on the navBar it will loads the index.asp inside the IFrame instead of load the page I expect to load.

I don't understand :confused: why it is happening.....

:D Any halp will be appreciated !!! :D

codeexploiter
03-05-2007, 11:03 AM
Can you provide a link to your website/page so that we can take a look at it using Firefox and IE.

mcg
03-05-2007, 11:08 AM
http://www.drivediagnostics.com/site/index.asp

mburt
03-05-2007, 11:23 AM
Oh, just by reading the post I can tell: You can't dynamically change the source of the frame using the .src attribute.
Use location.href instead:

<script language='javascript'>
function MClick(obj)
{
document.frames['myframe'].location.href = obj.getAttribute("linkAdd");
}
</script>

Give your iframe a name:

<iframe name="myframe"...

mcg
03-05-2007, 11:48 AM
Maybe but the IE is execute it right, any way what I try to do is to change the source of the IFrame dynamically and call the same page - now with the IFrame new source ..... only firefox parser don't pars it the way I expect .... any suggestion ? .... I don't know how to continue from here :-(

mcg
03-05-2007, 01:32 PM
I try to use your syntx but it is doesn't work for me ?
Code:
function MClick(obj){
// document.getElementById('MainContent').src = obj.linkAdd;
alert(obj.getAttribute("linkAdd"));
document.frames('MainContent').href = obj.getAttribute("linkAdd");
alert(document.frames('MainContent').href);
}
</script>
I did debug it and the content get into place [alert();]
(the second alert will not fire in firefox)
but it is not working even in IE I belive that I'm doing somthing wrong.

mcg
03-05-2007, 03:05 PM
If anyone have an idea, any idea what to do with it, I will be very happy to hear about it, Thank, me.