Ticket #2880: 3.asp

File 3.asp, 3.5 KB (added by gongheyong, 15 years ago)
Line 
1<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
2<!--#include file="../client/fckeditor/fckeditor.asp"-->
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml">
5<head>
6<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
7<script type="text/javascript" src="../client/fckeditor/fckeditor.js"></script>
8<title>Untitled Document</title>
9<script type="text/javascript">
10//<![CDATA[
11function getEditorTextContents(EditorName) {
12  var oEditor = FCKeditorAPI.GetInstance(EditorName);
13  var oDOM = oEditor.EditorDocument;
14  var iLength ;
15  if(document.all){
16    iLength = oDOM.body.innerText.length;
17  }else{
18    var r = oDOM.createRange();
19    r.selectNodeContents(oDOM.body);
20    iLength = r.toString().length;
21  }
22  return iLength;
23}
24function postPrevFilter(fString){
25    if(fString==""){
26        return;
27    }else{       
28        //fString =fString.replace(/'/g,"&#39;").replace(/\(/g,"&#40;").replace(/\)/g,"&#41;");         
29        fString=fString.replace(/'/g,"¡¯");
30        fString=fString.replace(/"/g,"¡±");
31        fString=fString.replace(/\(/g,"£¨");
32        fString=fString.replace(/\)/g,"£©");
33        return fString;
34    }
35}
36function alterMessage(mStatus,dName,mContent){
37    if(typeof document.getElementById(dName)!='undefined'){
38        try{
39            var messContainer=document.getElementById(dName);
40            messContainer.innerHTML=(mStatus)?"<font color=\"green\">"+mContent+"</font>":"<font color=\"red\">"+mContent+"</font>";
41        }catch(e){}
42    }
43}
44function filterEditorContents(EditorName){
45    var oEditor=FCKeditorAPI.GetInstance(EditorName);
46    //oEditorConn=postPrevFilter(oEditor.GetData()); 
47    oEditorConn=postPrevFilter(oEditor.GetXHTML(true)); 
48    oEditor.SetData(oEditorConn);   
49}
50function checkthisform(strForm){
51    if(getEditorTextContents("summary")==0){
52        alterMessage(false,"message","please write something!");                         
53        return false;
54    }
55    if(getEditorTextContents("summary")<10){   
56        alterMessage(false,"message","character is so small!");               
57        FCKeditorAPI.GetInstance("summary").Focus();
58        return false;
59    }   
60    filterEditorContents("summary");
61    if(getEditorTextContents("summary")>100){
62        alterMessage(false,"message","character is so more !"); 
63        return false;
64    }
65    strForm.filterconn.value=postPrevFilter(FCKeditorAPI.GetInstance("summary").GetData());
66    if(strForm.filterconn.value==""){
67        strForm.filterconn.focus();
68        alert("make dispatch textarea is empty!")
69        return false;
70    }
71    alert(strForm.filterconn.value);
72    return true;
73    //return false;
74}
75//]]>
76</script>
77</head>
78
79<body>
80<div id="results">
81        <form name="form1" method="post" action="4.asp" onsubmit="return checkthisform(this);">
82        <span id="message"></span>
83       <dl>
84             <dt>FCKEditor demo</dt>
85             <dd><%Dim oFCKeditor
86                   Set oFCKeditor = New FCKeditor
87                   oFCKeditor.BasePath = "../client/fckeditor/"
88                   oFCKeditor.ToolbarSet = "GuestUser"
89                   oFCKeditor.Value = ""
90                   oFCKeditor.Create "summary"
91                          %></dd>
92                <dd>so little 10 so more 100 per character</dd>
93                <dd><textarea name="filterconn" rows="7" cols="150"></textarea></dd>
94       </dl>
95       <label><input type="submit" name="btn2" value="post" /></label>
96       </form>
97</div>
98</body>
99</html>
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy