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

javascript取出div 中的值问题
<script   language=javascript>
<!--
function   check(){
        for(i=0;i <myform.picno.length;i++)
        if(myform.picno[i].checked==true){
var   tt1   =   myform.picno[i].value;
        var   tt   =   parseInt(tt1)   +parseInt( "11 ");
                document.getElementById( "t ").innerHTML   =   tt;
        }
}
function   alertinfo(){
alert(document.getElementById( "t ").value);
return   false;
}
-->
</script>
  <form   name=myform>
<input   type= "radio "   name= "picno "   value= "1 "   onclick= "javascript:check() ">
<input   type= "radio "   name= "picno "   value= "2 "   onclick= "javascript:check() ">
<input   type= "radio "   name= "picno "   value= "3 "   onclick= "javascript:check() ">
<div   id   =   "t "> </div>
<input   type= "submit "   name= "Submit "   value= "出价 "   onclick= "return   alertinfo() "/>
</form>

上面代码为什么alert不出t   的值?

------解决方案--------------------
alert(document.getElementById( "t ").innerHTML);
div没有value属性
------解决方案--------------------
alert(document.getElementById( "t ").innerText);