1.父頁(yè)面添加引用
<script type="text/javascript" src="<web.path:path/>/js/jquery.js"></script>
<script type="text/javascript" src="<web.path:path/>/js/thickbox.js"></script>
<link rel="stylesheet" href="<web.path:path/>/resources/css/thickbox.css" type="text/css" media="screen" />
2.父頁(yè)面添加如下按鈕,引用thickbox打開子窗口
<input alt="<web.path:path/>/bannedUserList!unBannedUserList?height=400&width=800&inlineId=myOnPageContent" title="Ban Another Users" class="thickbox" type="button" value="Ban Another"/>
3.子頁(yè)面添加按鈕或鏈接
<input id="banUser" type="button" value="Save"/>
<input id="closeBT" type="button" value="Cancel"/>
4.子頁(yè)面添加相關(guān)jQuery和thickbox代碼(因?yàn)楦疙?yè)面已經(jīng)引用了jQuery和thickbox庫(kù),子頁(yè)面不需要再引用)
<SCRIPT type="text/javascript">
$("#closeBT").click(function(){
??? tb_remove();
});
//click the save button to submit, close the current window and refresh the opener window
$("#banUser").click(function(){
??? //get the transfer params
??? var users = new Array();
??? $("input:checkbox").each(function(){
??? ??? if(this.checked) {
??? ??? ??? users.push($(this).val());
??? ??? }
??? });
???
??? $.ajax({
??? ??? type:"POST",
??? ??? url:"<web.path:path/>/bannedUserList!banUser",
??? ??? data:"users="+users.join(","),
??? ??? success:function(msg){
??? ??? ??? tb_remove();??? //close the thickbox
??? ??? ??? var win = top.window;
??? ??? ??? try{
??? ??? ??????? if(win){
??? ??? ?????????? win.location.reload(); ??? //refresh the opener window
??? ??? ??????? }
??? ??? ??? }catch(ex){}
??? ??? }
??? });
});
</SCRIPT>