By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,842 Members | 2,368 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,842 IT Pros & Developers. It's quick & easy.

Problem getting onresize to work

P: n/a
I'm having a problem getting the window.onresize to work properly. Here
is a simple test case I wrote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test window.onresize</title>
<script type="text/javascript">
function resize_func() {
alert ('resize_func has been called');
}
window.onresize = resize_func();
</script>
</head>
<body>
<p>Just Some Text</p>
</body>

When I load this page in firefox (1.0.6). I get the alert box that pops
up on initial load, but any subsequent resizing of the window fails to
trigger the event. It's probably something really simple, but so far
I'm stumped. Any help would be greatly appreciated. Thanks
--
Darrel
Oct 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Lee
Darrel Yurychuk said:

I'm having a problem getting the window.onresize to work properly. Here
is a simple test case I wrote:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Test window.onresize</title>
<script type="text/javascript">
function resize_func() {
alert ('resize_func has been called');
}
window.onresize = resize_func();


That last line executes resize_func() and assigns the return value
(void, in this case) to window.onresize. If you want to assign a
reference to your function to window.onresize, leave off the parentheses:

window.onresize=resize_func;

Oct 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.