indexSearch.jsp 1.33 KB
<%@page pageEncoding="UTF-8"%>  
<%
	String contextPath = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+contextPath+"/";
%>

<div class="div-search" id="divSearchContent" style="display:none;border: none">
	<input class="text-search" id="txtSearch" type="text" placeholder="搜 索" style="text-indent:6px"/>
	<input  id="searchType" value="" style=" display: none; "/>
	<div onclick="search()" id="searchbtn"  class="div-search-searchbtn">
		<img src="<%=basePath%>image/index/icon-search.png" width="19" height="19" />
	</div>
</div>
<jsp:include page="offline.jsp"></jsp:include>
<script type="text/javascript">
    var global = global || {};
    global = global || {};
    global.basePath = '<%=basePath%>';
    global.contextPath = '<%=contextPath%>'; 
    //回车搜索
	$('#txtSearch').keydown(function(e){
		if(e.keyCode==13){
			search();
			return false;
		}
	});  
	
    function search(){
    	var text = $('#txtSearch').val();
    	var type = $('#searchType').val();
    	if(!text){
    		return layer.msg("请输入查询字段!");
    	}  
    	console.log(text);
    	var _url = CONF_FRONT_SERVERURL+'/view/search-list.jsp?text='+encodeURI(encodeURI(text));
    	if(type){
    		_url += "&type="+type
    	}
    	window.open(handleJumpUrl(_url));
    }
</script>