...

View Full Version : Timing Issue



Hawk
07-11-2002, 08:06 PM
For some reason this does not work. If I place an alert box in before the last line, it works fine. Also, is this the correct code to maximize a window?

Thanks



function f_Pic(str_data)
{
var T = window.open('./hi.html','Window_PictureID','menubar=no,status=no,location=no,toolbar=no,hotkeys=no,resizable,width= screen.width,height=screen.height');
T.resizeTo(screen.availWidth,screen.availHeight);
T.moveTo(screen.width-screen.availWidth,screen.height-screen.availHeight);
T.focus();

T.document.imgMainPicture.src=str_data;
}

joh6nn
07-11-2002, 09:32 PM
doesn't work, because you're trying to access the picture, before the page has finished loading, so the picture doesn't actually exist yet. try this:


function f_Pic(str_data)
{
var T = window.open('./hi. html','Window_PictureID','menubar=no,status=no,loc
ation=no,toolbar=no,hotkeys=no,resizable,width=scr
een.width,height=screen.height');
T.resizeTo(screen.availWidth,screen.availHeight);
T.moveTo(screen.width-screen.availWidth,screen.height-screen.availHeight);
T.focus();
T.str_data = str_data;
T.onload = function() {
this.document.imgMainPicture.src=this.str_data;
}
}

Hawk
07-11-2002, 10:32 PM
Thanks for the replied John.

That was the feeling that I had. I knew that the error came up was because the image has not been loaded yet but I did not know how to wait until the load finish.

Anyway, the error is suppressed but the picture is not showing either.

joh6nn
07-11-2002, 10:39 PM
use an alert to make sure that str_data is what you think it is. also, if i remember correctly, IE can be picky about relative urls. try using an absolute url.

Hawk
07-11-2002, 10:59 PM
Thanks for your replied again.

Actually, I used the OnResize event and that worked.

By any chance do you know how to maximize a window?

Hawk
07-11-2002, 11:04 PM
Actually, resize doesn't work now either.

This is weird.

joh6nn
07-11-2002, 11:16 PM
windows can't be maximized. the best you can do is make them as big as the screen, which isn't worth it, in my opinion.

using the onresize event, wouldn't work. you'd have to use the onload event for this.

Hawk
07-12-2002, 12:11 AM
John,

Thanks for your help again.

I found out what happen. Your code worked fine. I reposition the script before the closing body tag and all is well now.

You make sure you have a good day now! :D:D



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum