举个栗子:
html:
1 <form acrtion="" method="post" id="form1"> 2 <div id="text" style="" contenteditable=”true“> 3 输入内容 4 </div> 5 <input type="hidden" name="divValue" id="divValue" /> 6 <a id="buttom">提交</a> 7 </form>
javascript:
window.onload=function(){
var divValue = document.getElementById(‘divValue‘).value,
text = document.getElementById(‘text‘).innerHTML,
buttom = document.getElementById(‘buttom‘);
divValue = text;
buttom.onclick = function(){
document.getElementById(‘form1‘).submit();
}
}
原文:http://www.cnblogs.com/hing/p/4373502.html