Link to home
Start Free TrialLog in
Avatar of BruceCheng
BruceCheng

asked on

How to set <body> onresize event from Javascript code?

For some reason, I need to use Javascript to set the onresize event of the body tag on my web page. I tried to use this:

document.body.setAttribute("onresize", "alert('aaa');");

But it doesn't work. Does anybody know how to use Javascript to set onresize event of body tag?

Thanks a lot.
Avatar of archrajan
archrajan

<body onresize = "alert('Resized')">
sorry that will nto work
<body  onResize="alert('HI')"">  this works
Avatar of BruceCheng

ASKER

I mean I need to set this "onresize" event javascript from Javascript code.

That <body> tag is from a global include file of my application. I cannot change the <body> tag at all.

Thanks.
ASKER CERTIFIED SOLUTION
Avatar of GwynforWeb
GwynforWeb
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial