1. Smooth degradation
<a href= "http://www.baidu.com/" title= "a Fengxz" onclick= "Poppup (This.getattribute (" href ")); return false;" >fengxz</a>//html
function Poppup (winurl) {
window.open (Winurl);
}//javascript
This link is available even if JavaScript is disabled.
2. Progressive enhancement
<a href= "www.baidu.com" title= "a Fengxz" class= "Poppup" >fengxz</a>//html
Window.onload=preparelink;
function Preparelink () {
var link=document.getelementsbytagname ("a");
for (Var i=0;i<link.length;i++) {
if (Link[i].getattribute ("class") = = = "Poppup") {
link[i].onclick=function{
Poppup (This.getattribute ("href"));
return false;
}
}
}
}
function Poppup (winurl) {
window.open (Winurl);
}//javasript
JavaScript is separated from the HTML document.
3. Backwards compatibility
if (!document.getelementsbytagname ("a")) return false, and so on, check whether the browser supports this method.
Smooth degradation of links, progressive enhancement, and backwards compatibility