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  
                  });
            }
    }      
 
 
 
posted @ 2017-07-29 21:33  石头-Stone  阅读(25840)  评论(0编辑  收藏  举报