---
title: "JS窗口改变触发事件"
author: "duyunfengsolo"
date: "2011-04-28T17:32:13Z"
tags: []
categories: ["编程语言"]
slug: "js"
draft: false
lastmod: "2011-04-28T17:32:13Z"
id: 1022117
url: "https://solodu.iteye.com/blog/1022117"
---

```
                var  resizeTimer = null;
	function doResize(){
		var url = '${ctx}/aa/monitor/alar/recharge.jsp';
		window.location.href = url;
	    //alert("width="+document.documentElement.clientWidth + "   Height="+document.documentElement.clientHeight);
	}
	window.onresize = function(){
	   if(resizeTimer) clearTimeout(resizeTimer);
	  resizeTimer = setTimeout("doResize()",0);
                }
```

 

```
window.onresize = function()
	{
		var url = '${ctx}/bomc3/monitor/alar/recharge.jsp';
		window.location.href = url;
	};
```

 

另外获取宽高：

document.documentElement.clientWidth

parent.document.body.clientWidth