views:

541

answers:

3

We are facing a weird problem in IE6. The page works fine in Firefox and IE7.

We have a page which has a div and a iframe within that div Example:

<html>
<body>
...
<div>
   <iframe src="page.aspx" />
</div>
</body>
</html>

Now assume page.aspx has this code:

<html>
<body>
..
 <a href="#" onclick="alert('just an alert');">click me</a>
</body>
</html>

Now if user clicks on the link 'click me' then the iframe moves! Here is a depiction of the behavior:

Before clicking on the link

After clicking on the link

It seems like none of the code written by us is causing an issue, as the only thing that happens when the user clicks on the link 'click me' is to just show an alert box.

has anybody faced a similar issue? Any pointers about how to resolve this problem?

PS: It is difficult for me to reproduce the problem with a simple example.

A: 

It would be nice if you could put up a very simple demo of this that on the public web somewhere. If you did that we could play around with it a little and see what's up.

Bill Rawlinson
It is difficult for me to reproduce the problem with a simple example.
Ngm
well i can't comment on your solution (I don't have enough points) but I'm glad you solved it.
Bill Rawlinson
+1  A: 

Ok, if we add width property to the iframe the problem disaapears

Ngm
A: 

Did you try to add a return false;? It's needed to avoid the default behavior of the anchor.

<a href="#" onclick="alert('just an alert');return false;">click me</a>
vacmf