js弹出窗口大小

JavaScript013

js弹出窗口大小,第1张

ajaxmenu根本就没有实现弹出DIV大小的参数!所以上面那段代码不能改变弹出窗口大小!要控制大小自已写一个函数下面是个例子://创建窗口

/*

* 创建窗口(参数说明)

* wWidth:int 窗口宽度

* wHeight:int 窗口高度

* wMainID:主窗口id

* wTitleID:string 标题ID

* wTitleText:string 标题内容

* wShowID:string 窗口要显示的位置(层ID)

* wFileURL:string 模板文件位置

*/

function CreateWindow(wWidth, wHeight, wMainID, wTitleID, wTitleText, wShowID, wFileURL) {

xmlHttp = initXMLHttpClient()

xmlHttp.open("GET", wFileURL, false)

xmlHttp.onreadystatechange = function() {

if (xmlHttp.readyState == 4) {

var response = xmlHttp.responseText

var tHeight = window.screen.availHeight //alert("创建窗口函数:" + window.screen.availHeight)

document.getElementById(wShowID).innerHTML = response

document.getElementById(wMainID).style.width = wWidth

document.getElementById(wMainID).style.height = wHeight

document.getElementById(wMainID).style.position = "absolute"

document.getElementById(wMainID).style.left = document.body.clientWidth / 2 - wWidth / 2

//document.GetElementById(wMainID).style.top = "50%"

document.getElementById(wTitleID).innerText = wTitleText

wTether = true

wWindow = 0

wCount++

}

}

xmlHttp.send(null)

}

alert是不行的 你用window.open(PageUrl,name,parameters) 打开窗口试试 这个就可以设置大小 如window.open('page.html','newWindwo','height=300,width=300')