欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SinaEditor使用方法詳解

 更新時間:2013年12月28日 09:52:44   作者:  
本篇文章主要是對SinaEditor使用方法進(jìn)行了詳細(xì)的介紹,需要的朋友可以過來參考下,希望對大家有所幫助

1.下載SinaEditor

2.JSP調(diào)用頁面

復(fù)制代碼 代碼如下:

<textarea name="problemBody" id="content" style="display:none;" textarea>
<iframe src="<%=request.getContextPath() %>/edit/editor.htm?id=content&ReadCookie=0" frameBorder="0" marginHeight="0" marginWidth="0" scrolling="No" width="621" height="457"></iframe>

其中,src="<%=request.getContextPath() %>/edit/editor.htm表示下載的SinaEditor中的editor.htm文件路徑;帶綠色的兩處ID須一致

3.下載的editor下包含有img.htm和attach.htm,其中第一個為上傳圖片的,第二個是上傳附件的,當(dāng)然兩個是一樣的使用方法,都可看做上傳文件的。

4.下面是img.htm中上傳圖片的一個示例。做記載方便下次使用。

復(fù)制代碼 代碼如下:

function chk_imgpath () {
    if($('radio1').checked==true){
   if($("imgpath").value == "http://" || $("imgpath").value == "") {
    window.close();
    return;
   }
   LoadIMG($("imgpath").value);
    }else{
       if($("file1").value == "") {
       alert("請選擇上傳圖片文件!");
       return;
       }
       var filepath = j("#file1").val();
       var filetype = filepath.substring(filepath.lastIndexOf('.'));
       var regu = ".gif.jpg.png.jpge.GIF.JPG.PNG";    

    if (regu.indexOf(filetype) == -1) {    
         alert('只允許上傳.gif.jpg.png.jpge 類型文件!');
         return ;   
     }
     var f = j('#form1');
     j.ajaxFileUpload({
             type : 'POST',
             secureuri : false,
             fileElementId : 'file1',
             url : '/ask/fileUpload?type=img',
             dataType : 'String',
             success : function(data){
              j("#imgpath").attr("value",data);
                  j("#radio1").attr("checked","true");
                   chk_imgpath();
                   $('divProcessing').style.display='';
             },
             error : function(data){
                 alert('文件上傳失敗');
             }
           });
    }
  }

5.后臺代碼編寫(不做敘述)

相關(guān)文章

最新評論