1. 首先注意需要调用thickbox的js
<script type="text/javascript" src="<%=path%>/js/jquery-1.8.3.min.js"></script> <script language="javascript" src="<%=path%>/js/thickbox.js"></script> <link rel="stylesheet" type="text/css" href="<%=path%>/css/thickbox.css"></link>
2. 关闭子页的时候,主要是调用了thickbox.js的tb_remove()函数
注:不能修改thickbox.js中的tb_remove()函数,因为那个是个基类,如果发生单独的业务,需要在自己的jsp中重载该方法,也就是说,
在父页的jsp中重写tb_remove()函数
//重载thickbox方法,实现刷新页面 function tb_remove() { $("#TB_imageOff").unbind("click"); $("#TB_closeWindowButton").unbind("click"); $("#TB_window").fadeOut("fast",function(){ $('#TB_iframeContent').remove();$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();}); $("#TB_load").remove(); document.onkeydown = ""; document.onkeyup = ""; //父页的局部刷新函数 selectDepartment(); return false; }
function selectDepartment() { var department_id = $('#d_id').val(); document.getElementById("marDepartmentId").value = department_id; $.ajax({ type: "POST", data: {"department_id":department_id}, url: "<%=path%>/departmentMar/getEmployeeByDepartmentId", dataType: "json", success : function(data) { $('#employee_id').empty(); var html = ''; $.each( data, function(commentIndex, comment) { html += '<option value="' + comment['key'] + '">' + comment['value'] + '</option>'; }); $('#employee_id').append(html); $('#employee_id').trigger("change"); } }); }