function popUp(winURL){ window.open(winURL,"popup","width=320,height=480");//打开一个名字为popup,地址为winURL,长480px,宽320px的页面。 }
<a herf="http://www.example.com/"return:false>Example</a> //当点击标签时不会跳转到herf指定的页面,return:false; <a herf="http://www.example.com/" onclick="popup(this.getAttribute("herf");return false;)">Example</a> // 执行点击事件。
window.onload=function(){ //当打开页面时运行相应的程序 if(!document.getElementBytagName) return false; var lnks=document.getElementByTagName("a"); for(var i=0;i<lnks.length;i++){ } }
function parperGallery(){ if(!documengt.getElementBTagName) return false; if(!document.getElementById) return false; if(!document.getElementById("imagegallery")) return false; var gallery =document.getElementById("imageallery") var links = gallery.getElementByTagName("a"); for(var i=0; i<links.length;iu++){ links[i].onclick =function(){ return showpic(this) ? false:ture; } } } function showpic(whichpic){ if(!document.getElementById("place")) return false; var source=whichpic.getAttribute("herf") var place=document.getElementById("place") place.setAttribute("src",source) if(document.getElementById("description")){ var text=whichpic.getAttribute("title") var description=document.getElementById("description") description.firstChild.nodevalue =text; } return ture; }