【发布时间】:2013-03-31 13:00:09
【问题描述】:
这是代码
<?php
if (isset($_POST['flag'])) {
$length=strlen(trim($_POST['area']));
echo "Length of abstract : ".$length;
if (!strlen(trim($_POST['area']))){
$abstractErrorMsg = "Please enter the abstract of your article";
echo $abstractErrorMsg;
}
}
?>
<form method="post" action="">
<input type="hidden" name="flag" value="hidden">
<script type="text/javascript" src="http://js.nicedit.com/nicEdit-latest.js"></script>
<script type="text/javascript">
//<![CDATA[
bkLib.onDomLoaded(function() {
nicEditors.editors.push(
new nicEditor().panelInstance(
document.getElementById('myNicEditor')
)
);
});
//]]>
</script>
* Abstract
<textarea name="area" id="myNicEditor" style="width: 300px;height: 100px;"></textarea>
<input type="submit" name="btn">
</form>
如果我提交表单时未向 nicedit textarea 输入任何文本,则显示长度 = 4。 为什么会这样? nicedit textarea 有默认值吗?如果是,如何更改?
【问题讨论】:
-
这真的是原码吗?我假设您在
textarea标签之间有一些空白字符…… -
不,标签之间没有一个空格。这是原始代码。