4.0想取出textarea框里的值进行判断在提交,但不知道怎么取出来。谢谢。
实验代码如下:
怎么能在check()里取textarea值,并实现check()中的判断功能;谢谢。请高人给菜鸟指点一下。
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'add.jsp' starting page</title>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
</head>
<body>
<script language="JavaScript" src="<%=request.getContextPath()%>/js/check.js"></script>
<link rel="stylesheet" href="<%=request.getContextPath()%>/kindedit/themes/default/default.css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/kindedit/plugins/code/prettify.css" />
<script charset="utf-8" src="<%=request.getContextPath()%>/kindedit/plugins/code/prettify.js"></script>
<script language="JavaScript" type="text/javascript" src="<%=request.getContextPath()%>/kindedit/kindeditor.js"></script>
<script language="JavaScript" type="text/javascript" src="<%=request.getContextPath()%>/kindedit/lang/zh_CN.js"></script>
<script language="Javascript">
KindEditor.ready(function(K) {
var editor = K.create('textarea[name="product"]', {
cssPath : '<%=request.getContextPath()%>/kindedit/plugins/code/prettify.css',
uploadJson : '<%=request.getContextPath()%>/kindedit/jsp/upload_json.jsp',
fileManagerJson : '<%=request.getContextPath()%>/kindedit/jsp/file_manager_json.jsp',
allowFileManager : true
});
//prettyPrint();
});
//判断textarea是否为空并提交
function check()
{
if (isEmpty(form1.product.value) || form1.product.value=="null " || form1.product.value=="null" || form1.product.value=="<p> </p>" || form1.product.value=="<p>null</p>")
{
alert("请填写商品描述");
return false;
}
form1.action="<%=request.getContextPath()%>/demo.jsp";
form1.target="_self";
form1.submit();
}
</script>
<FORM name=form1 action="" method="post" target=_self>
<textarea id=editor_id name=product style="width:700px;height:200px;"></textarea> <br>
<INPUT name="button" type="button" onClick="check()" value=发布新商品>
</FORM>
</body>
</html>