点击弹出新窗口的javascript解决方法,很简单实用,代码如下:
function popup() {
if(!document.getElementsByTagName || !document.getElementsByTagName("a")) return false;
a = document.getElementsByTagName("a");
for(i=0;i<a.length;i++) {
if(a[i].getAttribute("rel") && a[i].getAttribute("rel") == "external") {
a[i].onclick = function() {
window.open(this.getAttribute('href'));
return false;
};
}
}
}在web文档中,定义a 的属性rel为external弹出新窗口,用来代替target="_blank"。