这是HTML和脚本
<script> $(document).ready(function(){
$(".update_button").click(function(){
var update_post = $("#post").val();
alert('Post is '+ update_post +'.');
return false;
});
});
</script>
<body>
<fieldset style="width:600px; height:550px">
<textarea id="post" class="uiwysiwyg nothing"><?php echo $prvpost; ?></textarea>
<input type="submit" value="Post" id="updt_button" class="update_button"/>
</fieldset> </body>
注意:class="uiwysiwyg nothing" 是一个包含所见即所得命令的脚本
但代码有效:
<body onsubmit="alert('Update: ' + document.getElementById('post').value); return false;">
<fieldset style="width:600px; height:550px">
<textarea id="post" class="uiwysiwyg nothing"><?php echo $prvpost; ?></textarea>
<input type="submit" value="Post" id="updt_button" class="update_button"/>
</fieldset>
</body>