﻿function searchTitle(strTitle){
   var title=document.getElementById(strTitle).value;
   title=encodeURIComponent(title.replace(/(^\s*)|(\s*$)/g, ""));
   if(title.length<=0){
      alert("搜索内容不能为空！");
   }else{
     location.href='../Topic/SearchTopic.aspx?title='+title;
   }
}

function searchUserName(strUserName){
   var userName=document.getElementById(strUserName).value;
   userName=encodeURIComponent(userName.replace(/(^\s*)|(\s*$)/g, ""));
   if(userName.length<=0){
      alert("搜索内容不能为空！");
   }else{
      location.href='../Topic/SearchTopic.aspx?userName='+userName;
   }
}

function searchContent(strContent){
   var content=document.getElementById(strContent).value;
   content=encodeURIComponent(content.replace(/(^\s*)|(\s*$)/g, ""));
   if(content.length<=0){
      alert("搜索内容不能为空！");
   }else{
      location.href='../Topic/SearchTopic.aspx?content='+content;
   }
}

function search(strType,strFilter){
    var type=document.getElementById(strType);
    var filter=document.getElementById(strFilter).value;
    filter=encodeURIComponent(filter.replace(/(^\s*)|(\s*$)/g, ""));
    var selectText=type.options[type.selectedIndex].value;
    if(filter.length<=0){
       alert("搜索内容不能为空！");
    }else{
      if(selectText=="title"){
         location.href="../Topic/SearchTopic.aspx?title="+filter;
      }else if(selectText=="username"){
         location.href="../Topic/SearchTopic.aspx?userName="+filter;
      }else if(selectText=="content"){
         location.href="../Topic/SearchTopic.aspx?content="+filter;
      }
    }
}
