js如何 同时 打开 多个 窗口

JavaScript010

js如何 同时 打开 多个 窗口,第1张

var praArr = [1,2,3,4,5]

function multyOpen(Ids){

for(var i in Ids){

var checkandedit = new Object()//每次都要把对象new一下,否则内存中始终是同一个对象。

checkandedit = window.open('a.html?co='+Ids[i],'_blank')

}

}

新建两个窗口,一个父窗口,一个子窗口。

_复翱诨袢∽哟翱谟辛街址椒ǎ谝恢址椒ㄊ牵好扛龆加幸桓_ontentWindow属性, 通过contentWindow可获取子窗口;第二种方法是:window对象有frames属性,它是一个类数组对象,可以通过数字或窗体名进行索引。

_庋胝夷歉龃翱诰涂梢灾付ㄕ夷歉龃翱诹恕?

function modalDialog(url, name, width, height)

{

if (width == undefined)

{

width = 400

}

if (height == undefined)

{

height = 300

}

x = (window.screen.width - width) / 2

y = (window.screen.height - height) / 2

window.open(url, name, 'height='+height+', width='+width+', left='+x+', top='+y+', toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, modal=yes')

}你研究下这个js函数,把window.open百度下,搞熟你知道怎么做了

以上调用 modalDialog("http://www.baidu.com/", 'baidu')

modalDialog("http://www.qq.com/", 'qq')