Best Practices

  function popUp(winURL){
   window.open(winURL,"popup","width=320,height=480");//Open a page named popup, address winURL, 480px long and 320px wide.
}

  <a herf="http://www.example.com/"return:false>Example</a> //When the label is clicked, it will not jump to the page specified by herf, return: false;
  <a herf="http://www.example.com/" onclick="popup(this.getAttribute("herf");return false;)">Example</a> // 执行点击事件。

  window.onload=function(){ //Run the corresponding program when the page is opened
    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;
}







Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326120014&siteId=291194637