FCKEditor AND AjaxPro

 

 

// JScript 文件
//var myObject=new Object();
var customerEmailArray="";

 function init()
{
   var oFCKeditor = new FCKeditor("content");
    oFCKeditor.BasePath = "../FCKeditor/";
    oFCKeditor.Width='100%';
    oFCKeditor.Height = '400';
    oFCKeditor.ToolbarSet = "Default";
    oFCKeditor.ReplaceTextarea();
}

function  CreateEditor()
{
 var oFCKeditor = new FCKeditor("content");
    oFCKeditor.BasePath = "../FCKeditor/";
    oFCKeditor.Width='100%';
    oFCKeditor.Height = '400';
    oFCKeditor.ToolbarSet = "Default";
    oFCKeditor.ReplaceTextarea();
}

function showCustomerList()
{
 // alert ("dddd");
 
 // var a=SendMail.aa().value;
  var my_array =new  Array();
  var tempUserType= document.getElementById("userType")
  var type = tempUserType.options[tempUserType.selectedIndex].value
 
  selectCustomerList.innerHTML="<span>sadfasfdasfda</span>";
 
  var r=SendMail.getUserList(type.toString()).value;
 
  if (r){
  my_array=r.users;
 
  selectCustomerList.innerHTML="<table><tr>"
  for (var i=0;i<r.userCount;i++){
  
   //selectCustomerList.innerHTML+="<td><span>"+my_array[i].xingming+"<span/></br><td>";
   selectCustomerList.innerHTML+="<td><input type='checkbox' value='"+my_array[i].email.toString().trim()+"' id='checkBoxGroup' name='checkBoxGroup'/>"+my_array[i].xingming+"</br></td>";
  
   }
   selectCustomerList.innerHTML+="</tr></table>";
  
   }else
   {
       selectCustomerList.innerHTML="<span>暂无此类联系人!<span/>"
   }
  // alert("erqewrqwreqwreqwreqwreqre");
}


 function checkAll(allChkId,chkId){
  var chkObj = eval("document.all." + chkId);
  var chkAllObj = eval("document.all." + allChkId);
  if(chkObj){
  for (var i=0;i<chkObj.length;i++){
   chkObj[i].checked = chkAllObj.checked;
  }
  }
 }


function selectCustomer(chkId)
{

      
   //     alert("2222222222222222222");
        var chkObj = eval("document.all." + chkId);
  //judge chkObj.length
  //customerEmailArray="";
  var customerEmails="";
  if (chkObj){
  for (var i=0;i<chkObj.length;i++){
   if (chkObj[i].checked == true)
   {
   customerEmails+= chkObj[i].value+" ";
   }
   
  }
  document.all.txtToEmails.value=customerEmails;
  
        alert(customerEmails);  
        }
}


function fileUpload(controlID){
 try{
  var adjuncts=""
  var control=document.getElementById(controlID)
  if(control.options && control.options.length>0){
   for(var i=0;i<control.options.length;i++){
    adjuncts+=control.options[i].value+"!"+control.options[i].text+"|"
   }
  }
  if(adjuncts)
   adjuncts=adjuncts.substr(0,adjuncts.length-1)
  var adjunctTemplateUrl="FileUploadTemplate.aspx"
  //var adjunctUrl=myObject.controls[controlID].adjunctUrl
  var adjunctUrl=""
  var url=adjunctTemplateUrl+"?AdjunctUrl="+adjunctUrl+"&Adjuncts="+encodeURIComponent(adjuncts)
  var args=showModalDialog(url,null,"scroll:no;status:no;dialogWidth:400px;dialogHeight:400px")
  if(control.options && control.options.length>0){
   while(control.options.length){
    control.options.remove(0)
   }
  }
  if(args){
   args=args.split("|")
   for(var i=0;i<args.length;i++){
    var value=args[i].split("!")[0]
    var text=args[i].split("!")[1]
    var option=document.createElement("OPTION")
    option.value=value
    option.text=text
    control.options.add(option)
   }
  }
 }
 catch(e){
  alert(e.message)
 }
}

 

function handleBack(){
    var adjuncts=""
    var lbFiles=document.getElementById("lbFiles");
    for(var i=0;i<lbFiles.options.length;i++){
     adjuncts+=lbFiles.options[i].value+"!"+lbFiles.options[i].text+"|"
    }
    if(adjuncts)
     adjuncts=adjuncts.substr(0,adjuncts.length-1)
    window.returnValue=adjuncts
    window.close()
   }

//使用Ajax发送邮件,调用SendMail.SendAllMail();
//parameter
//public bool SendSingleMail(string clientMailTo, string messageSubject, string messageBody, string messageAttachments)
//function sendMail(clientMailToList,messageSubject,messageBody,controlID)
function sendMail()
{
    var clientMailToList=document.getElementById("txtToEmails").value;
    var messageSubject=document.getElementById("txtSubject").value;
   
    var messageBody=getMessageBody();
   //controlID为附件那个下拉框ID
    var messageAttachments=translateAttachments("fujian");
  
   if ((clientMailToList.trim()=="")||(messageSubject.trim()=="")||(messageBody.trim()==""))
   {
       
        alert("请检查收件人列表、主题、邮件内容是否有空,请填写")
        return;
   }
   
    var allReturnValue=""
   
    var returnValue=""

    if(clientMailToList){
   var clientMailTos=clientMailToList.split(" ")
   for(var i=0;i<clientMailTos.length;i++){
   
   returnValue=SendMail.SendSingleMail(clientMailTos[i],messageSubject,messageBody,messageAttachments).value;
   allReturnValue+=returnValue+" ";
   
   }
    }
   
 //   var returnV=""
 //   returnV.deleteAttachments(messageAttachments).value;
   
    alert (allReturnValue);
}

//
//controlIDwei fujian select ID
//fanhui

function translateAttachments(controlID)
{
    var adjuncts=""
   
    var control=document.getElementById(controlID)
  if(control.options && control.options.length>0){
   for(var i=0;i<control.options.length;i++){
    //adjuncts+=control.options[i].value+"!"+control.options[i].text+"|"
    adjuncts+=control.options[i].value+"|"
   }
  }
 if(adjuncts)
 {
     adjuncts=adjuncts.substr(0,adjuncts.length-1)
 }
 return adjuncts;
       
   
   
}

//获取FCKEditor内的值,即邮件内容
//'content'为FckEditor的ID值
function getMessageBody()
{
   var s;

   // Try to get the FCKeditor instance, if available.
 var oEditor ;
 if ( typeof( FCKeditorAPI ) != 'undefined' )
 {
     oEditor = FCKeditorAPI.GetInstance( 'content' ) ;
 } else
 {
     CreateEditor()
     oEditor = FCKeditorAPI.GetInstance( 'content' ) ;
 }
 return oEditor.GetXHTML();
 
}

//<input type="checkbox" value="1" id="id">编号1

//<input type="checkbox" value="2" id="id">编号2

//<input type="checkbox" value="3" id="id">编号3


//<button id="btnTest" onclick="return t()">testCount</button>
//<button id="btnTest" onclick="return showAllChk('id')">showAll</button>
//<button id="btnTest" onclick="return myCheckAll('id')">全选ID</button>
//<button id="btnTest" onclick="return unCheckAll('id')">全不选ID</button>
//<button id="btnTest" onclick="return checkId('id')">检查ID</button>
//<input type="checkbox" value="" id ="ALL" name="ALL" onClick = "checkAll('ALL','id')"/><label for="ALL">全选</label>

//<script type="text/javascript">
// function t(){
//  alert(document.all.id.length);
// }

// function showAllChk(chkId)
// {
//  var chkobj = eval("document.all." + chkId);
//  for(var i=0;i<chkobj.length;i++){
//   alert(chkobj[i].value);
//  }
// }
// 
// function checkAll(allChkId,chkId){
//  var chkObj = eval("document.all." + chkId);
//  var chkAllObj = eval("document.all." + allChkId);
//  for (var i=0;i<chkObj.length;i++){
//   chkObj[i].checked = chkAllObj.checked;
//  }
// }

// function myCheckAll(chkId)
// {
//  var chkobj = eval("document.all." + chkId);
//  for(var i=0;i<chkobj.length;i++){
//   chkobj[i].checked = true;
//  }
// }

// function unCheckAll(chkId)
// {
//  var chkobj = eval("document.all." + chkId);
//  for(var i=0;i<chkobj.length;i++){
//   chkobj[i].checked = false;
//  }
// }
// 
// function checkId(chkId)
// {
//  var chkobj = eval("document.all." + chkId);
//  var result = false;
//  for(var i=0;i<chkobj.length;i++){
//   if (chkobj[i].checked){
//    result = true;
//    break;
//   }
//  }
//  if (!result){
//   alert("请至少选一个编号");
//   chkobj[0].focus();
//  }
//  return result;

// }
//</script>

 

//function LoadStates_CallBack(response)
//{
////如果服务器端代码出现异常
//if (response.error != null)
// {
////我们应该能做得更好
//alert(response.error);
//return;
// }
//var states = response.value;
////如果不是我们所希望的响应
//if (states == null || typeof(states) != "object")
// {
//return;
// }
////获得州下拉列表
//var statesList = document.getElementById("states");
//statesList.options.length = 0; //重置州下拉列表
////记住,其长度不是 JavaScript 中的 Length
//for (var i = 0; i < states.length; ++i)
// {
////如命名属性一样公开行的列
//statesList.options[statesList.options.length] =
//new Option(states[i].State, states[i].Id);
// }
//}

你可能感兴趣的:(fckeditor)