某些情况下要求页面不被嵌入框架页中,如登录页面,下面的代码可以实现该功能: < script language " savascript " > if (self != top) ... { // 被嵌在框架里的情况 top.location=self.location; } if (opener) ... { // 被window.opne()函数弹出的情况 opener.location.replace(self.location); self.close(); } if (window.dialogArguments) ... { // 被window.showModalDialog()等弹出模态窗口的情况 window.dialogArguments.location.replace(self.location); self.close(); } </ script >