onresize it not working with XMLHTTP

F

FrankIsHere

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!
 
J

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
 
J

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,058
Members
48,769
Latest member
Clifft

Latest Threads

Top