• function create(parentId,eleType,eleName,eleId,eleValue){  
  •         var board = document.getElementById(parentId);  
  •         var e = createElement("input",eleName);  
  •         e.type = eleType;  
  •         e.id = eleId;  
  •         e.value = elevalue;   
  •         board.appendChild(e);  
  •         //设置选中  
  •         e.setAttribute("checked","checked");  
  •         //添加文字  
  •         board.appendChild(document.createTextNode("Item"));  
  •    }  
  •      
  •    function createElement(type, name) {     
  •        var element = null;     
  •        try {     
  •           // First try the IE way; if this fails then use the standard way    
  •           element = document.createElement_x('<'+type+' name="'+name+'">');     
  •        } catch (e) {     
  •           // Probably failed because we’re not running on IE  
  •        }     
  •        if (!element) {     
  •           element = document.createElement(type);     
  •           element.name = name;     
  •        }     
  •        return element;     
  •     } 

相关文章:

  • 2021-12-09
  • 2022-02-07
  • 2021-10-16
  • 2021-12-31
  • 2022-02-25
猜你喜欢
  • 2022-01-05
  • 2021-10-11
  • 2021-05-30
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案