<form id="form1" method="post" action="pupost" >
<div>
<label style="font-size:18px;">标题:</label>
<input id="poTitle" name="poTitle" type="text" style="width:610px; height:25px; font-size:14px;" />
</div>
<div id="poText" contenteditable="true" style="width:610px; height:170px; background-color:#FFFFFF; margin-left:60px; font-size:13px;"></div>
</div>
<input type="submit" class="btn10" onMouseOver="this.style.backgroundPosition='left -40px'" onMouseOut="this.style.backgroundPosition='left top'" value="发 表" />
</form>
如果想把poText的innerHTML传给servlet pupost 应该怎么办?
------解决方案--------------------
- HTML code
<html> <head> <script> function mysubmit() { var str = document.getElementById("mydiv").innerHTML; document.getElementById("content").value = str; document.forms["myform"].submit(); } </script> </head> <body> 在servlet里用request.getParameter("content")获取 <form id="myform" action="你的servlet路径" method="post"> <input type="hidden" name="content" id="content"/> <div id="mydiv">qwerqwegqwegqweg</div> <input type="button" onclick="mysubmit()" value="提交"/> </form> </body></html>