这段js代码是什么意思??

ipipip1735 2009-12-19 09:22:55
<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>
...全文
149 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
ermuzi 2009-12-19
  • 打赏
  • 举报
回复
有点晕。。。。。。。。
sundotLei 2009-12-19
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ipipip1735 的回复:]
只用解释下面3段话!!

1. <body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
中的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"  是什么意思
[/Quote]
1,页面加载完成后过1秒钟执行loadForm()函数
2,当editor.EditMode.checked为true时,将编辑器中的文本内容(不包含html)保存在名称为Content的textarea中
3,下拉框选项改变时,执行changelocation函数,参数值为当前选择的option值.
wanglf1207 2009-12-19
  • 打赏
  • 举报
回复
太菜了
sundotLei 2009-12-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 ipipip1735 的回复:]
第2段话中的editor.EditMode.checked==true
editor是表单中的一个插件名
<input name="Editor" type="hidden" id="Editor" value="">
后面的EditMode.checked==true
应该怎么理解??
[/Quote]

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模式
ipipip1735 2009-12-19
  • 打赏
  • 举报
回复
第2段话中的editor.EditMode.checked==true
editor是表单中的一个插件名
<input name="Editor" type="hidden" id="Editor" value="">
后面的EditMode.checked==true
应该怎么理解??
ipipip1735 2009-12-19
  • 打赏
  • 举报
回复
只用解释下面3段话!!

1. <body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
中的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" 是什么意思
ipipip1735 2009-12-19
  • 打赏
  • 举报
回复
只有解释段话!!

1.<body leftmargin="5" topmargin="10" onLoad="javascipt:setTimeout('loadForm()',1000);">
中的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" 是什么意思

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧