value 属性可设置文本域的默认值。

出于安全考虑,一些浏览器可能阻止 JavaScript 代码读取 value 属性。

 

下面的例子可获得文本域的默认值:

<html>
<head>
<script type="text/javascript">
function alertValue()
{
alert(document.getElementById("text1").value)
}
</script>
</head>
<body>

<form>
<input type="textfield" />
</form>

</body>
</html>







相关文章:

  • 2021-06-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-01
猜你喜欢
  • 2021-09-20
  • 2021-09-01
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2019-12-25
相关资源
相似解决方案