admin管理员组文章数量:1332352
<form name="myForm" method="post" onsubmit="return getComment()">
<textarea id="mentarea"></textarea>
<input type="text" name="locate" value="<%=rs.getString("location")%>">
<input type="submit" value="View Comment">
</form>
function getComment(){
<% String locate=request.getParameter("locate"); %>
var location = <%= locate%>;
document.getElementById('mentarea').value=location;
return false;
}
Everytime i click View Comment, there's no value printed. I want to access locate in the scriptlet and print the value in the text area. I know this is not the best way to access it, but i need to access it in this way. Can anyone help me?
<form name="myForm" method="post" onsubmit="return getComment()">
<textarea id="mentarea"></textarea>
<input type="text" name="locate" value="<%=rs.getString("location")%>">
<input type="submit" value="View Comment">
</form>
function getComment(){
<% String locate=request.getParameter("locate"); %>
var location = <%= locate%>;
document.getElementById('mentarea').value=location;
return false;
}
Everytime i click View Comment, there's no value printed. I want to access locate in the scriptlet and print the value in the text area. I know this is not the best way to access it, but i need to access it in this way. Can anyone help me?
Share Improve this question asked Dec 7, 2011 at 16:17 joannajoanna 1171 gold badge4 silver badges12 bronze badges1 Answer
Reset to default 2You have missed double/single quotes for the value of the location variable. If you don't need to submit the form, just use a button input element.
<form name="myForm" method="post">
<textarea id="mentarea"></textarea>
<input type="text" name="locate" value="<%=rs.getString("location")%>">
<input type="button" value="View Comment" onclick="getComment()">
</form>
function getComment(){
<% String locate=request.getParameter("locate"); %>
var location = "<%= locate%>";
document.getElementById('mentarea').value = location;
}
本文标签: javascripttextbox value to scriptletStack Overflow
版权声明:本文标题:javascript - textbox value to scriptlet - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742321710a2452922.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论