【发布时间】:2011-06-27 10:26:33
【问题描述】:
我有一个文本框元素,我尝试使用document.getElementById("id-name").value 访问其值。我发现调用返回的是 null 而不是空字符串。返回值的数据类型仍然是字符串。 null 是字符串值吗?
<input type="text" value="" id="mytext"> 是我尝试使用 var mytextvalue = document.getElementById("mytext").value; 获取其值的文本框
【问题讨论】:
-
@BonyT,
<input type="text" value="" id="mytext">是我尝试使用var mytextvalue = document.getElementById("mytext").value;获取其值的文本框 -
jsfiddle.net/UVdVe ???看不出问题!
标签: javascript string dom null