js在頁面中打開新的窗口


一、

新建一個窗口,完全獨立

var tabTitle = "test";
var url ="test.action";
var icon = 'icon-add';

window.parent.addTab(tabTitle, url, icon); 

在窗口上懸浮一個窗口,兩窗口在同一個HTML文檔

<div id="test"></div> 
$('#test').dialog({
title: 'test',
width: 570,
height: 500,
closed: false,
cache: false,
resizable: true,
href:'test.action',
modal: true
}); 
.dialog出現過一個問題:
<**id="test1" name="test1"**>底層頁面
<**id="test2" name="test1"**>dialog加載的窗口
都添加combotree,通過ajax加載值,底層選值后,dialog中的下拉列表中就沒有值了
window.parent.reloadTab("重新加載的頁面","需要關閉的頁面");  

 

二、

可以在窗口內新建窗口

1,超鏈接<a href="http://test.jsp" title="測試">Welcome</a>

等效於js代碼

window.location.href="http://test.jsp";     //在同當前窗口中打開窗口

 

2,超鏈接<a href="http://test.jsp" title="測試" target="_blank">Welcome</a>

等效於js代碼

window.open("http://test.jsp");                 //另外新建窗口中打開窗口

3,在頁面div中加載html(屬性雙引號,在雙引號內嵌單引號)
   <div id="parent"></div>
   $("#parent").html("<p>duan</p>")
先通過ajax請求jsp,然后返回對應HTML,然后通過html(..)來把返回的html代碼 指定 加載到指定的位置上
 
4.在頁面div中加載jsp頁面
  $("#parent").load("test.jsp);//有問題?
 
5.待測試
$.post(contextpath+"/auth/conpanyloading",data = $("#seachcName").val(),function(data){

$("#conpany_id").html(data);
},"html");

 
6利用easyui標簽新建窗口(在瀏覽器中新建窗口,easyui窗口)
<div id="tabs1" class="easyui-tabs" fit="true" border="false"> </div>
 
function testAddSubPage(title,url){               
            if ($("#tabs1").tabs('exists', title)){  
                $("#tabs1").tabs('close', title);  
                var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';   
                   $("#tabs1").tabs('add',{  
                                      title:title,  
                                      content:content,  
                                      closable:true  
            });  
            } else {
                  var content = '<iframe scrolling="auto" frameborder="0"  src="'+url+'" style="width:100%;height:100%;"></iframe>';   
                   $("#tabs1").tabs('add',{  
                                      title:title,  
                                      content:content,  
                                      closable:true  
                  });
            }
    }      
 
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM