下面是Javascript代码:
function showCard(linkTarget) {
var propertyWidth = 400;
var propertyHeight = 350;
var winLeft = (screen.width-propertyWidth)/2;
var winTop = (screen.height-propetyHeight)/2;
var winOptions = "toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=no";
winOptions += ",width=" + propertyWidth;
winOptions += ",height=" + propertyHeight;
winOptions += ",left=" + winLeft;
winOptions += ",winTop=" + winTop;
cardWindow = window.open(link.target,"cardInfo", winOptions);
cardWindow.focus();
}
var cardWindow;
href =“valentine.jpg”onclick =“showCard('valentine.jpg'); return false”>情人节
(我删除了标签,因为代码没有显示出来)
答案 0 :(得分:0)
window.open(link.target...)
应为window.open(linkTarget...)
这导致错误,因此永远不会达到return false;
并且链接正常导航。
答案 1 :(得分:0)
在我看来你的问题就在这里:
您的功能声明为:
function showCard(linkTarget)
但你引用稍后在代码中传递的参数,带点为
cardWindow = window.open(link.target,"cardInfo",winOptions);