代码改变世界
    
    
    
    
    
        
            
            
    
    
    
2012-03-19 10:46 
多折腾 
阅读(716) 
评论() 
 
收藏 
举报
    
        
- 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;      
-     }