原页面是被框架分割了的,代码是这样的
<frameset cols="12%,*" border=10>
<frame src="left.jsp" name="left" scrolling="no" noresize="noresize">
<frame src="right.jsp" name="right">
</frameset>
如果我在这个页面点击一个链接弹出一个新的页面,此时我想立即把原页面自动关闭,该如何实现?
<frameset cols="12%,*" border=10>
<frame src="left.jsp" name="left" scrolling="no" noresize="noresize">
<frame src="right.jsp" name="right">
</frameset>
如果我在这个页面点击一个链接弹出一个新的页面,此时我想立即把原页面自动关闭,该如何实现?
window.parent.close();试试看,不知道能否行,我也是个菜鸟,:)
点连接的时候做一个js在js里做关闭操作
function openAndClose(){
<!-- 下面是无提示关闭Temp1.html的代码 -->
var ua=navigator.userAgent
var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
if(ie) {
var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
if(IEversion< 5.5) {
var str = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
str += '<param name="Command" value="Close"></object>';
document.body.insertAdjacentHTML("beforeEnd", str);
document.all.noTipClose.Click();
}
else {
window.opener =null;
window.close();
}
}
else {
window.close()
}
<!-- 使用window.open链接Temp2.html -->
window.open('Temp2.html', '_black','height=400, width=600, status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no')
} openAndClose();
</script> <html>
<head>
<title>temp1.html</title>
</head>
<body>
<a href="xxxxxxxxx" onClick="openAndClose();">
</body>
</html>