[['type','text']改成[['type','text',1]就好了.就是写漏个1;
=======================================
var parentEle=document.getElementById("calender");
var TimeInput=newElement('div',[['align','right',1]],false,parentEle);
  var selectHour=newElement('input',[['type','text',1],['name','InputHH'],['onBlur',function(){checkNO(this.value,this.name)}]], false, TimeInput);
=======================================
这种我也不知道是什么写发,我觉得javascript是好用,就是没有好的语法帮助,或者参考资料!

解决方案 »

  1.   

    一个自定义函数罢,你还是仔细分析一下 document.createElement()
    再添加 innerHTML
      

  2.   

    现在发先写出来的只是<input name=InputHH>;并没有type=text
    这为什么?
      

  3.   


    用createElement方法来创建,参考下面的例子
    <HTML>
    <HEAD>
    <SCRIPT>
    function createRadioButton(){
        // Create radio button object with value="First Choice" and then insert 
        // this element into the document hierarchy.
        var newRadioButton = document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='First Choice'>")
        document.body.insertBefore(newRadioButton);
        // Create radio button object with value="Second Choice" and then insert 
        // this element into the document hierarchy. 
        newRadioButton = document.createElement("<INPUT TYPE='RADIO' NAME='RADIOTEST' VALUE='Second Choice'>")
        document.body.insertBefore(newRadioButton);
    }
    </SCRIPT>
    </HEAD><BODY>
    <INPUT TYPE="BUTTON" ONCLICK="createRadioButton()" VALUE="Create two Radio Buttons"><BR><INPUT TYPE="BUTTON" ONCLICK="alert ( document.body.outerHTML )" VALUE="Click here to see HTML"><BODY>
    </HTML>
      

  4.   

    我是想知道是否我用newElement写错了什么地方?
      

  5.   

    newElement中间加空格new Element我也不知道这是什么函数,是prototype里的?
      

  6.   

    1。定义你想要的text
    2。creatElement创建一个td。
    3。用innerhtml把text放到td里
      

  7.   

    var parentEle=document.getElementById("calender");
    var TimeInput=newElement('div',[['align','right',1]],false,parentEle);
     var selectHour=newElement('input',[['type','text',1],['name','InputHH']], false, TimeInput);
    ==================================================================================
    前面的ID为"calender"的已经是一个容器div了!就是不知道怎样用newElement创建一个text或者一个<input type="button"><input type="text">?