2009-10-09 69 views
0

下面的javascript,打算打开一个新窗口跳转到指定的锚点,在IE中很好用。不幸的是,在Firefox中,它会打开窗口,但它不会跳转到锚点。window.open()与Firefox中的锚点打不开3

我一直在努力解决这个问题几天(搜索和修改)无济于事。

如果有人有任何了解,我怎么能得到这个像预期的那样在IE Mozilla浏览器的工作,我会永远感激。

下面是一个包含window.open()和链接调用包含函数window.open()JavaScript函数:

<html> 
<head> 
<script language=javascript> 
function openPopupWindow_Why(sPopupUrl, sPopupLabel) 
{ 
    window.open(sPopupUrl, sPopupLabel, 'toolbar=no,resizable=yes, 
     scrollbars=yes,height=250,width=450', false); 
    return false; 
} 
</script> 
</head> 
<body> 
<A onclick="openPopupWindow_Why('MyProfile_WhyAsk.htm#ethnicity', 'Why')" 
    href="javascript:void(0)" class="WhyAsk">Why do we ask?</a> 
</body> 
</html> 

这里的页面上的HTML锚多数民众赞成通过打开window.open():

<tr> 
    <td align="center"> 
    <a name="#ethnicity">&nbsp;</a> 
    </td> 
</tr> 

回答

1

尝试从种族锚点名称删除#像这样:

<tr> 
    <td align="center"> 
    <a name="ethnicity">&nbsp;</a> 
    </td> 
</tr> 

至少在IE,火狐和Chrome中工作

+0

你修正了戈登。多谢! – cjo30080 2009-10-12 16:32:16