您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息
三六零分类信息网 > 铁岭分类信息网,免费分类信息发布

SinaEditor使用方法详解_jquery

2024/3/17 17:24:16发布33次查看
1.下载sinaeditor
2.jsp调用页面
复制代码 代码如下:
其中,src=/edit/editor.htm表示下载的sinaeditor中的editor.htm文件路径;带绿色的两处id须一致3.下载的editor下包含有img.htm和attach.htm,其中第一个为上传图片的,第二个是上传附件的,当然两个是一样的使用方法,都可看做上传文件的。
4.下面是img.htm中上传图片的一个示例。做记载方便下次使用。
复制代码 代码如下:
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.后台代码编写(不做叙述)
铁岭分类信息网,免费分类信息发布

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录