Javascript 如何使用plan HTML访问JSP中的隐藏值
我有一些隐藏的值,如下所示Javascript 如何使用plan HTML访问JSP中的隐藏值,javascript,html,jsp,Javascript,Html,Jsp,我有一些隐藏的值,如下所示 <input type="hidden" id="id_clientCount" value="ClientCount" /> <input type="hidden" id="id_AppCount" value="AppCount" /> 现在,我希望像这样在我的JSP页面中访问它们 <div style="margin-left: 30%; color: green;"><b>Confirmation</
<input type="hidden" id="id_clientCount" value="ClientCount" />
<input type="hidden" id="id_AppCount" value="AppCount" />
现在,我希望像这样在我的JSP页面中访问它们
<div style="margin-left: 30%; color: green;"><b>Confirmation</b></div><br/>
client value: <script>document.getElementById('id_clientCount').value</script>
app Value : <script>document.getElementById('id_AppCount').value</script>
<div id="testChild" style="height: 15em"></div>
如果我做错了,请纠正我
注意:整个代码都在一个JSP页面中
预期产出为:
客户端值:ClientCount应用程序值:AppCount
非常感谢您的帮助。您忘记在屏幕上打印该值,请使用文档。编写。。。打印。如下所示: 确认客户价值: document.writedocument.getElementById'id\u clientCount'。值; 应用价值: document.writedocument.getElementById'id\u AppCount'。值;
您忘记在屏幕上打印该值,请使用文档。写入。。。打印。如下所示: 确认客户价值: document.writedocument.getElementById'id\u clientCount'。值; 应用价值: document.writedocument.getElementById'id\u AppCount'。值; 试试这个
<input type="hidden" id="id_clientCount" value="ClientCount" />
<input type="hidden" id="id_AppCount" value="AppCount" />
<div style="margin-left: 30%; color: green;"><b>Confirmation</b></div><br/>
client value: <span id="id_clientCountId"></span><BR>
app Value : <span id="id_AppCountId"></span>
<div id="testChild" style="height: 15em"></div>
<script>
fill();
function fill(){
document.getElementById("id_clientCountId").innerHTML = document.getElementById('id_clientCount').value;
document.getElementById("id_AppCountId").innerHTML = document.getElementById('id_AppCount').value;
}
</script>
试试这个
<input type="hidden" id="id_clientCount" value="ClientCount" />
<input type="hidden" id="id_AppCount" value="AppCount" />
<div style="margin-left: 30%; color: green;"><b>Confirmation</b></div><br/>
client value: <span id="id_clientCountId"></span><BR>
app Value : <span id="id_AppCountId"></span>
<div id="testChild" style="height: 15em"></div>
<script>
fill();
function fill(){
document.getElementById("id_clientCountId").innerHTML = document.getElementById('id_clientCount').value;
document.getElementById("id_AppCountId").innerHTML = document.getElementById('id_AppCount').value;
}
</script>
还有一个dooubt Swathi,如果它的纯JSP页面不起作用。你能建议我你不重视它吗?通过使用document.write?你能详细说明一下纯jsp是什么意思吗?在纯HTML中我会得到值。但在JSP页面中,我不会得到值。我犯了什么错误吗。或者错过了一些东西。如果可能的话,你可以再来聊天室一次dooubt Swathi,如果它的纯JSP页面不起作用。你能建议我你不重视它吗?通过使用document.write?你能详细说明一下纯jsp是什么意思吗?在纯HTML中我会得到值。但在JSP页面中,我不会得到值。我犯了什么错误吗。或者错过了什么。如果可能的话,你能来聊天室吗