<select onchange="if(selectedIndex!=0)document.execCommand(value,true,'fason')">
<option>插入控件</option>
<option value="InsertInputButton">普通按钮
<option value="InsertButton">动态按钮
</select>

解决方案 »

  1.   

    不知道你的动态按钮是怎样?
    <body>
    <script>
    function getButton(v){
    var sB=document.getElementById("sButton")
    switch(v){
    case "InsertInputButton":sB.innerHTML="<input type='button' value='"+v+"'>"
    case "InsertButton":sB.innerHTML="<input type='button' value='"+v+"'>"
    }
    }
    </script>
    <select onchange="if(selectedIndex!=0)getButton(value)">
    <option>插入控件</option>
    <option value="InsertInputButton">普通按钮
    <option value="InsertButton">动态按钮
    </select>
    <span id="sButton"></span>
    </body>
      

  2.   

    <script>
    function aa(o)
    {
    if(o.selectedInex==0) return
    switch(o.options[o.selectedIndex].value)
    {
    case "InsertInputButton":
    InsertButton.style.display='none'
    InsertInputButton.style.display=''
    break;
    case "InsertButton":
    InsertButton.style.display=''
    InsertInputButton.style.display='none'
    break;
    }
    }
    </script>
    <select onchange="aa(this)">
    <option>插入控件</option>
    <option value="InsertInputButton">普通按钮
    <option value="InsertButton">动态按钮
    </select>
    <input name=InsertInputButton style="display:none"><input name=InsertButton  style="display:none" type=button value="InsertButton">
      

  3.   

    你是否想在<textarea>或<input>的文本框中插入按钮呢,如果我没有理解错你的意思的话我觉得这样是不能的!
      

  4.   

    谢谢fason(阿信),你的回答给了我很大的启示!to danky():
    对,我的意思就是你的理解,
    而且我这里也有一个可能的例子,
    你有兴趣研究研究吗?我的意思是在<textarea>或<input>中出现按钮,
    这样就意味着生成的按钮是可编辑的,我可以拖动,改变它的位置!
      

  5.   

    你的意思是想作在线编辑器?
    要放在textarea或input中是不行的,或者你可以用层,把按钮放到层中,再定位
      

  6.   

    http://fason.nease.net/code/js/other/htmleditor.htm
      

  7.   

    to:danky()我可能有点明白了,能插入控件,是因为它用Active X做了一个控件
    嵌入到了网页中,然后才能实现的,谢谢了!