日期:2014-05-17  浏览次数:20829 次

能改变input的type属性吗
例如把button换成submit

------解决方案--------------------
应该不可以,无法获取type属性 js
------解决方案--------------------
删了重建一个
------解决方案--------------------
可以用这种方法(在IE,FireFox下通过)
<form name= "form1 " method= "post " action= "reg.asp ">
姓名:
<input type= "text " name= "name ">
<input type= "button " name= "test " value= "测试 " onclick= "change() "/>
<div id= "temp "> <input type= "button " name= "temp " value= "用来改变 " /> </div>
</form>
<script type= "text/javascript ">
function change()
{
var temp=document.getElementById( "temp ");
alert( "文本: "+temp.innerHTML);
temp.innerHTML= " <input type=\ "submit\ " value=\ "改变后的\ " /> "
}
</script>