Javascript没有在隐藏字段中输入值的问题
-
08-07-2019 - |
题
疯狂的问题在这里。
我的页面加载时:<body onload="getClientDateTime();">
它运行此功能:document.getElementById('ClientDateTime').value="hello world";
理论上应该插入<!>“hello world <!>”;进入一个隐藏的领域:<INPUT TYPE="hidden" name="ClientDateTime" id="ClientDateTime" value="">
但她没有工作。
如果我将字段更改为键入<!> quot; text <!> quot;然后它就像它应该的那样工作,但不能作为<!>“隐藏的<!>”;请帮忙!
解决方案
这实际上是有效的,因为它会提示正确的值:
<html>
<head>
<title>Test</title>
</head>
<body onload="document.getElementById('ClientDateTime').value='hello world'; alert(document.getElementById('ClientDateTime').value);">
<input type="hidden" name="ClientDateTime" id="ClientDateTime" value="" />
</body>
</html>
不隶属于 StackOverflow