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

HTML表单的value值能否为参数?如何表示?
var   a=15
在 <input   type= "text "   name= "R2 "   value= " "   size= "15 "> 语句中value怎么赋变量a,在网页上才可以显示15。



------解决方案--------------------
用JS
var a = 15;
document.formname.R2.value = a;
------解决方案--------------------
<body>
<input type= "text " value= " " name= "txt1 " id= "txt1 ">
<script>
var txt1=document.getElementById( "txt1 ")
var a=15;
alert(txt1.value);
txt1.value=a;
alert(txt1.value);
</script>
</body>