关于innerText和value的区别?
innertext是文本值,value是元素的值。
代码
代码如下:
<html>
<head>
<script type="text/javascript">
function show(obj){
alert(obj.value);
}
function showD(obj){
alert(obj.innerText);
}
</script>
</head>
<body>
<div onclick="showD(this)">innerText</div>
<input type="button" value="value"onclick="show(this)"></input>
</body>
</html>
代码展示如下:
转载至
https://zhidao.baidu.com/question/1958888135302625420.html
总结
提示:这里对文章进行总结:
如图所示 ,,,, innertext是文本值,value是元素的值。