<script language = "JavaScript">
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("数据库字段"))%>","<%= trim(rs("数据库字段"))%>","<%= trim(rs("S数据库字段"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
} function CheckForm()
{
if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; if (document.myform.Title.value=="")
{
alert("姓名不能为空!");
document.myform.Title.focus();
return false;
}
if (document.myform.Content.value=="")
{
alert("简介内容不能为空!");
editor.HtmlEdit.focus();
return false;
}
return true;
}
function loadForm()
{
editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
return true
}
</script>上面的是js代码
下面的是表单<body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="ArticleSave.asp?action=add" target="_self">
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1"
</select>
<select name="SpecialName"> </select>
<input name="Title" type="text" id="Title" size="80" maxlength="255">
<input name="Author" type="text" id="Author" size="66" maxlength="30">
<input name="Editor" type="hidden" id="Editor" value="">
<input name="CopyFrom" type="text" id="CopyFrom" size="66" maxlength="255">
<textarea name="Content" style="display:none"></textarea>
<input name="IncludePic" type="checkbox" id="IncludePic" value="yes">
<input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="56" maxlength="200">
<select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;"></select>
<input name="UploadFiles" type="hidden" id="UploadFiles">
<input name="Passed" type="checkbox" id="Passed" value="yes" checked>
<input name="OnTop" type="checkbox" id="OnTop" value="yes">
<input name="Hot" type="checkbox" id="Hot" value="yes" onClick="javascript:document.myform.Hits.value=<%=HitsOfHot%>">
<input name="Elite" type=checkbox id="Elite" value="yes" checked>
<input name="Hits" type="text" id="Hits" value="0" size="10" maxlength="10">
<input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50"><input name="Add" type="submit" id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';">
<input name="Preview" type="submit" id="Preview" value=" 预 览 " onClick="document.myform.action='../Admin_Preview.asp';document.myform.target='_blank';">
</form>
var onecount;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("数据库字段"))%>","<%= trim(rs("数据库字段"))%>","<%= trim(rs("S数据库字段"))%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;function changelocation(locationid)
{
document.myform.SmallClassName.length = 1;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.SmallClassName.options[document.myform.SmallClassName.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
} function CheckForm()
{
if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; if (document.myform.Title.value=="")
{
alert("姓名不能为空!");
document.myform.Title.focus();
return false;
}
if (document.myform.Content.value=="")
{
alert("简介内容不能为空!");
editor.HtmlEdit.focus();
return false;
}
return true;
}
function loadForm()
{
editor.HtmlEdit.document.body.innerHTML=document.myform.Content.value;
return true
}
</script>上面的是js代码
下面的是表单<body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
<form method="POST" name="myform" onSubmit="return CheckForm();" action="ArticleSave.asp?action=add" target="_self">
<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1"
</select>
<select name="SpecialName"> </select>
<input name="Title" type="text" id="Title" size="80" maxlength="255">
<input name="Author" type="text" id="Author" size="66" maxlength="30">
<input name="Editor" type="hidden" id="Editor" value="">
<input name="CopyFrom" type="text" id="CopyFrom" size="66" maxlength="255">
<textarea name="Content" style="display:none"></textarea>
<input name="IncludePic" type="checkbox" id="IncludePic" value="yes">
<input name="DefaultPicUrl" type="text" id="DefaultPicUrl" size="56" maxlength="200">
<select name="DefaultPicList" id="DefaultPicList" onChange="DefaultPicUrl.value=this.value;"></select>
<input name="UploadFiles" type="hidden" id="UploadFiles">
<input name="Passed" type="checkbox" id="Passed" value="yes" checked>
<input name="OnTop" type="checkbox" id="OnTop" value="yes">
<input name="Hot" type="checkbox" id="Hot" value="yes" onClick="javascript:document.myform.Hits.value=<%=HitsOfHot%>">
<input name="Elite" type=checkbox id="Elite" value="yes" checked>
<input name="Hits" type="text" id="Hits" value="0" size="10" maxlength="10">
<input name="UpdateTime" type="text" id="UpdateTime" value="<%=now()%>" maxlength="50"><input name="Add" type="submit" id="Add" value=" 添 加 " onClick="document.myform.action='ArticleSave.asp?action=add';document.myform.target='_self';">
<input name="Preview" type="submit" id="Preview" value=" 预 览 " onClick="document.myform.action='../Admin_Preview.asp';document.myform.target='_blank';">
</form>
中的onLoad="javascipt:setTimeout('loadForm()',1000)是什么意思2.if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
这个是什么意思3.<select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1"
</select>
中的onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1" 是什么意思
中的onLoad="javascipt:setTimeout('loadForm()',1000)是什么意思 2.if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
这个是什么意思 3. <select name="BigClassName" onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1"
</select>
中的onChange="changelocation(document.myform.BigClassName.options[document.myform.BigClassName.selectedIndex].value)" size="1" 是什么意思
editor是表单中的一个插件名
<input name="Editor" type="hidden" id="Editor" value="">
后面的EditMode.checked==true
应该怎么理解??
editor应该是一个在线编辑器对象从这句话
if (editor.EditMode.checked==true)
document.myform.Content.value=editor.HtmlEdit.document.body.innerText;
else
document.myform.Content.value=editor.HtmlEdit.document.body.innerHTML; 可以理解到EditMode.checked==true是控制当前编辑器模式是文本模式(类似于textare)还是html模式
2,当editor.EditMode.checked为true时,将编辑器中的文本内容(不包含html)保存在名称为Content的textarea中
3,下拉框选项改变时,执行changelocation函数,参数值为当前选择的option值.