问题
I'm trying to use javascript to open a popup window. It works in chrome but not in IE or Firefox.
Here is my code for the head section:
<head>
<script type="text/javascript">
function newPopup(url) {
popupWindow = window.open(
url,'popUpWindow','height=400,width=400,left=550,top=200,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes')
}
</script>
</head>
And my code in the body section:
<body>
<a href="javascript:newPopup('buy-now/ambush-jacket.html');" target="_new"><img src="images/banner/buy.gif"></a>
</body
>
And here is a link to the page: http://riverswest.com/riverswest-site/ambush-jacket.html
The BUY NOW image what you want to click on.
回答1:
The issue is your target="". You don't need it if you're going to be using javascript popup code.
This works fine:
<a href="javascript:newPopup('buy-now/ambush-jacket.html');"><img src="images/banner/buy.gif"></a>
来源:https://stackoverflow.com/questions/18005077/im-trying-to-use-javascript-to-open-a-popup-window-it-works-in-chrome-but-not