主题: 谁能给一个详细的asp调用的例子啊
作者: 茶叶蛋, 发布日期: 2011-11-02 23:40:20, 浏览数: 4701

editor.sync(); //editor是K.create返回的对象

 

这个如何在asp中实现呢?

 

我都郁闷了2天了哦

 

QQ:33064140     

 

我到现在 上传附件和  图片等编辑功能没有问题,但是我就是无法把    文本编辑框的内容,保存到数据库中,我做了个表单检测,总是提示我     content 为空 ,取消判断,我的数据库中content字段中也是空空的

 

我是这样调用的有什么不对的么?

editor.sync(); //editor是K.create返回的对象 该如何添加

 

 

 

 <link rel="stylesheet" href="../editor/themes/default/default.css" />
 <link rel="stylesheet" href="../editor/plugins/code/prettify.css" />
 <script charset="utf-8" src="../editor/kindeditor.js"></script>
 <script charset="utf-8" src="../editor/lang/zh_CN.js"></script>
 <script charset="utf-8" src="../editor/plugins/code/prettify.js"></script>

<script>
        var editor;
        KindEditor.ready(function(K) {
                editor = K.create('#editor_8', {
                        resizeType : 0,
                        cssPath : '../editor/plugins/code/prettify.css',
      uploadJson : '../editor/asp/upload_json.asp',
      fileManagerJson : '../editor/asp/file_manager_json.asp',
      allowFileManager : true
                });
        });
</script>

 

 

 

 

<textarea id="editor_8" name="Mcontent" style="width:700px;height:300px;">  </textarea>

作者: 小浪子, 发布日期: 2011-11-03 09:25:23
发全点。还有ASP代码呢?
回复
作者: 茶叶蛋, 发布日期: 2011-11-03 14:51:27

完全代码:如下

 

 

 <link rel="stylesheet" href="../editor/themes/default/default.css" />
 <link rel="stylesheet" href="../editor/plugins/code/prettify.css" />
 <script charset="utf-8" src="../editor/kindeditor.js"></script>
 <script charset="utf-8" src="../editor/lang/zh_CN.js"></script>
 <script charset="utf-8" src="../editor/plugins/code/prettify.js"></script>

<script>
        var editor;
        KindEditor.ready(function(K) {
                editor = K.create('#editor_8', {
                        resizeType : 0,
                        cssPath : '../editor/plugins/code/prettify.css',
      uploadJson : '../editor/asp/upload_json.asp',
      fileManagerJson : '../editor/asp/file_manager_json.asp',
      allowFileManager : true      
                });
        });
</script>

 

 

Function AddType()
 if CheckRight(tmpModuleId,tmpId,"Insert")=false then
  Tip(""&error402&"")
 end if
%> 
  <form name="frmAdd" method="post">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr> 
        <td width="88%"><img src="img/Info.gif" width="16" height="16"> 
          增加数据 </td>
            <td width="12%" align="right" valign="bottom"><a href="javascript:history.back(1);"><img src="img/bcak.gif" width="45" height="16" border="0"></a></td>
          </tr>
      <tr> 
        <td colspan="2"> 
          <hr color="#CAD9EA" size="1px">          </td>
          </tr>
      </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td bgcolor="#006699"> 
              <table width="100%" border="0" align="center" cellspacing="1">
                <tr > 
                  <td height="25" colspan="3" background="img/bg1.gif"><font color="#FF0000"> <span class="STYLE4">&nbsp;</span></font><span class="STYLE4"><strong>请输入新增信息资料</strong></span></td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td width="8%" height="23" align="right" valign="middle">选择类型:</td>
                  <td colspan="2">
                    <select name="MType" id="MType" style="width:150;behavior:url(common/include/select.htc)">
       <%
       SET tmpRs=Server.CreateObject("ADODB.recordset")
       tmpSql="select FId,FName from lb where FParentId = 1 order by FId"
       tmpRs.Open tmpSql,conn,1,1
       If tmpRs.RecordCount>0 Then%>
       <option value="0" selected>===请选择类型===</option>
       
      
       <%for i=1 to tmpRs.RecordCount%>
       <option value="<%=tmpRs(0)%>"><%=tmpRs(1)%></option>
       <%
       tmpRs.movenext
       next
       %>
       <%End If:tmpRs.close:Set tmpRs=nothing%>
                    </select>                  </td>
                </tr>
                <tr bgcolor="#FFFFFF">
                  <td height="23" align="right" valign="middle">标&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题:</td>
                  <td colspan="2"><input name="MTitle" type="text" class="bot" id="MTitle" size="60" maxlength="100" />
                  <font color="#ff0000">*</font></td>
                </tr>
    <span id="str">
                <tr bgcolor="#FFFFFF">
                <td height="23" align="right" valign="middle">内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容:</td>
                <td colspan="2"><span id="str">
    
    <textarea id="editor_8" name="MContent" style="width:700px;height:300px;visibility:hidden;"></textarea>
    
       </span></td>
                </tr>
    </span> 
                <tr bgcolor="#FFFFFF">
                <td height="23" align="right" valign="middle">部&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;门:</td>
                <td width="68%"><select name="DeptName" id="DeptName"  style="width:110;behavior:url(common/include/select.htc)">
    <%response.write getfield("TMAdmin","FId",tmpId,"FDeptId")%>
                <%
        Set RsA = Server.CreateObject("Adodb.Recordset")
     Sql = "Select FId,FName from TMDept where FId="&getfield("TMAdmin","FId",tmpId,"FDeptId")&" Order by FId asc"     
     RsA.open sql,conn,1,1
     response.write sql
     if RsA.Recordcount > 0 then
     do while not RsA.Eof
     response.write "<option value="&RSA("FName")&"> "&RSA("FName")&"</option>"
     RsA.movenext
     loop
     end if
     RsA.Close
     %>
                  </select>  
                  发布人:
                  <input name="UserName" type="text" id="MDate2" maxlength="64" class="bot1" value=<%=(getField("TMAdmin","FId",tmpId,"FName"))%> >                   
                    发布日期:
                  <input name="MDate" type="text" id="MDate3" maxlength="64" class="bot1" value="<%=curdate%>" /></td>
                <td width="24%">
  <INPUT name="btnOK" type="button" class="btn1" value="提交" onClick="FormSubmit()" title="提交并保存数据">
        <INPUT name="btnReset" type="reset" class="btn1" value="重写" title="取消当前的输入">    </td>
                </tr>
            </table>          </td>
          </tr>
        </table>
        <div align="right"><br>

        </div>
      </form>
          <%
End Function
'////////////////////////////////////////////////////////////////////////////////////////
Function AddTypeSave()
 Dim MTitle,MContent,DeptName,TDeptName,MDate,MType
 '取值
 MTitle          = Trim(Request("MTitle"))
 DeptName   = Trim(Request("DeptName"))
 UserName   = Trim(Request("UserName"))
 MDate        = Trim(Request("MDate"))
 MType               =   Trim(request("MType"))
 sContent    =  Request.Form("MContent")
 
 
 url        = "Message.do?Action=ListType&ClassId="&MType 

 
 If MType = 0 Then
  Call Tip("出错,请选择公告类型!")
 End If
 
 If MTitle = "" or IsNull(MTitle) Then
  Call Tip("出错,标题不能为空!")
 End If
 
 If sContent = "" or IsNull(sContent) or len(trim(sContent)) < 1 Then
  Call Tip("出错,内容不能为空!")
 End If

 Set Rs = Server.CreateObject("Adodb.RecordSet")
 Sql = "Select top 1 * From [Message] where MTitle='"&MTitle&"' and MType='"&MType&"'"
 Rs.Open Sql,Conn,3,3
 if Rs.RecordCount >= 1 then
  Tip("该类型信息的标题已经存在,请重新输入...")
 else
 Rs.AddNew
 Rs("MType")         =   MType
 Rs("MTitle")  = MTitle
 Rs("MContent")  = sContent
 Rs("DeptName")  = DeptName
 Rs("TDeptName")  = 0
 Rs("UserName")      =   UserName
 Rs("MDate")         =   MDate
 Rs.Update
 Call setHis(tmpUser,now(),"Message","添加公告",1)
 end if
 Rs.Close
 Set Rs = Nothing
 Call ExeSuccess(url)
End Function
回复
作者: 小浪子, 发布日期: 2011-11-03 17:53:26
sContent    =  Trim(Request.Form("MContent"))

If (sContent = "" or IsNull(sContent)) Then
  Call Tip("出错,内容不能为空!") 
End If

 

 

试试

回复
作者: 中国帝购网络, 发布日期: 2011-11-04 02:32:27

我遇到的情况跟你查不多!不过我的代码相对简单很多!

 

你可以看下我的解决办法!

http://www.kindsoft.net/view.php?bbsid=5&postid=4132&pagenum=1

也许对你会有启发!

顺便如果能解释我的问题 就更好了~:)

回复
发表新帖 发表回复