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

onresize it not working with XMLHTTP

P: n/a
This should attach the event to the onresize of the window object, but
when I try to resize the browser after executing the page it does not
work... only after I refresh the page. But then of course that's after
the HTTP request. Here is the code:

<HTML>
<HEAD>
<script language="javascript">
function Loadit() {
var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
var sURL = "http://tempuri.org";
var sHttpMethod = "GET";
oHTTP.Open(sHttpMethod, sURL, false);
oHTTP.Send();
document.write("\<body onresize=\"alert('resize test
1');\"\>\</body\>\</html\>");
}
</script>
</HEAD>
<BODY onload="Loadit()" >

</BODY>
</HTML>

I even tried it by triggering this script right before the body end:
<script>window.attachEvent("onresize", alert('resize test 2'))</script>

How do I make the onresize statement execute?! Is this a bug? I'm
using IE 6

Thanks!

Jan 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
JMB
<HTML>
<HEAD>
<script language="javascript">
function Loadit() {
alert('loading page');
}

function resizeFunct()
{

alert('RESIZE TEST');

}

window.onload=Loadit;
window.onresize=resizeFunct;
</script>
</HEAD>
<body></body>
</HTML>

The thing that sux about this is that the onresize event works twice. So,
you get two notices.

Hope this gives you a point of reference though.

Take it easy,
Jim

<Fr*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
This should attach the event to the onresize of the window object, but
when I try to resize the browser after executing the page it does not
work... only after I refresh the page. But then of course that's after
the HTTP request. Here is the code:

<HTML>
<HEAD>
<script language="javascript">
function Loadit() {
var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
var sURL = "http://tempuri.org";
var sHttpMethod = "GET";
oHTTP.Open(sHttpMethod, sURL, false);
oHTTP.Send();
document.write("\<body onresize=\"alert('resize test
1');\"\>\</body\>\</html\>");
}
</script>
</HEAD>
<BODY onload="Loadit()" >

</BODY>
</HTML>

I even tried it by triggering this script right before the body end:
<script>window.attachEvent("onresize", alert('resize test 2'))</script>

How do I make the onresize statement execute?! Is this a bug? I'm
using IE 6

Thanks!

Jan 8 '06 #2

P: n/a
JMB
Made it not repeat. Since you are using an Active X controller for the
XMLHTTPREQUEST onject, I didn't add a facility to verify the different
browsers.

<HTML>
<HEAD>
<script language="javascript">
var resizeValue=1;

function Loadit() {
var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
var sURL = "http://tempuri.org";
var sHttpMethod = "GET";
oHTTP.open(sHttpMethod, sURL, false);
oHTTP.send(null);

}

function resizeFunct()
{

if(resizeValue%2==0)
alert('RESIZE TEST');

++resizeValue;

}

window.onload=Loadit;
window.onresize=resizeFunct;
</script>
</HEAD>
<body></body>
</HTML>

That should be exactly what you are looking for.

Later
<Fr*********@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
This should attach the event to the onresize of the window object, but
when I try to resize the browser after executing the page it does not
work... only after I refresh the page. But then of course that's after
the HTTP request. Here is the code:

<HTML>
<HEAD>
<script language="javascript">
function Loadit() {
var oHTTP = new ActiveXObject("Microsoft.XMLHTTP");
var sURL = "http://tempuri.org";
var sHttpMethod = "GET";
oHTTP.Open(sHttpMethod, sURL, false);
oHTTP.Send();
document.write("\<body onresize=\"alert('resize test
1');\"\>\</body\>\</html\>");
}
</script>
</HEAD>
<BODY onload="Loadit()" >

</BODY>
</HTML>

I even tried it by triggering this script right before the body end:
<script>window.attachEvent("onresize", alert('resize test 2'))</script>

How do I make the onresize statement execute?! Is this a bug? I'm
using IE 6

Thanks!

Jan 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.