开发者

Window Open in IE not working

Could someone help me understand why this link works perfectly in firefox but in IE the pop up window doesn't work?

<a href="javascript:void window.open('/assets/flash/sage200demo.html', 'Sage 200 Demo', 'width=1024,height=768,status=0,resizable=0')">
开发者_运维技巧


The spaces in the 2nd argument to window.open are causing the problem. This argument is the window name and IE doesn't like it if you have spaces in it. This will work:

<a href="javascript:void window.open('/assets/flash/sage200demo.html', 'Sage200Demo', 'width=1024,height=768,status=0,resizable=0');">

Working demo: http://jsfiddle.net/Lx4sQ/


Try to change it to the following:

<a href="javascript:window.open('/assets/flash/sage200demo.html', 'Sage200Demo', 'width=1024,height=768,status=0,resizable=0');return false;">

or better yet

<a href="#" onclick="window.open('/assets/flash/sage200demo.html', 'Sage200Demo', 'width=1024,height=768,status=0,resizable=0');return false;">

or better yet

<script>
function openWindow(e) {
  e.preventDefault();
  window.open('/assets/flash/sage200demo.html', 'Sage200Demo', 'width=1024,height=768,status=0,resizable=0');
}
</script>
<a href="#" onclick="openWindow(event);">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜