Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Window Onload flickers

Status
Not open for further replies.

cuetzpalin

Programmer
Jun 5, 2002
99
US
I have a page that displays a record id on which is tagged with <a href </a>. When the record id is clicked it opens a new window. The window has a vbscript sub routine that looks like this:
**********************************
Sub window_onload
call window.onload ("./AAA_StoreEntryForm.asp","AAA_StoreEntryForm",scrollbars=no,status=no,toolbar=no,location=no,directories=no,menubar=no)

Call window.moveTo((screen.width - 550) \ 2, (screen.height - 570) \ 2 )
call window.resizeTo(550, 570)

End Sub
*************************************
The moveto and resize works fine. It's the window.onload that acts goofy. It flickers for about 5 minutes then stops. Then when you close the window another instance exists with scrollbars, directories, location, toolbar...all the stuff I don't want.

Please help.

Thank you,
Ed
 
I have never coded asp, and I don't see anything wrong with your code, however the symptoms you describe would have me looking for an infinite loop in my code that kept opening the window until the server timed out. It's only a guess, but that would explain the flickering, the 5 minute time limit and the existance of another window when you close the looping one.

Like I say, just a guess.

Roy
 
Code:
Sub window_onload
call window.onload

That looks suspiciously like a potential loop to me. Calling window.onload inside a subroutine that's supposed to run when the window is loaded?


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
I agree with Tracy. When I first saw the code, I wondered why the onload event handler was calling itself. I've not seen the event handler used with the same parameters as window.open, either. In my experience, the single parameter passed to it is supposed to be a function to be called when the page is finished loading.

As well, this is actually the Javascript forum, not VBScript.

Lee
 
Do you have any suggestions on how to accomplish this in javascript?

Thanks.
 
The advice being put forward is that the line call window.onload(...) is no good. (I seriously doubt you mean window.open()). I can think of different reasons : [1] It is calling itself and it is the first line of statement, hence, it is a infinite recurrent loop; [2] window.onload sub does not take arguments by construction and then when you call it, you enclose some arguments meaning a design misunderstanding.

It is not a matter of making it jscript and the problem will be solved.

- tsuji
 
If it is not some other purpose than a typo, it should be
[tt]
call window.[red]open[/red] ("./AAA_StoreEntryForm.asp","AAA_StoreEntryForm", [red]"[/red]scrollbars=no,status=no,toolbar=no,location=no,directories=no,menubar=no[red]"[/red])[/tt]
 
If the name of the page is AAA_StoreEntryForm.asp, then tsuji's code will create an unending sstream of popups until the computer either runs out of memory or is shut off.

Lee
 
Sure, any window.open with popup at loadtime will be of this phenomenon. Are you saying trollacious, window.open is not the reasonable guess rather than call window.load be more reasonable?
- tsuji
 
I'd say both are probably wrong. The parameters in that window.onload call are definitely wrong, and if the name of the page is the same as what he has now, using window.open would just open another window with the same URL, which would open another window with the same URL, etc. I'd get rid of that line completely. The window already opened, and has loaded, so only needs to be resized and moved to the desired coordinates.

Lee
 
trollacious,

How do you know AAA_StoreEntryForm.asp is the page in the parent calling window.open. I do not know it. I would not assume it. If it does, and that page has a window.open popup calling itself, even though with the same target name, is non-sensical.

- tsuji
 
Of course it's nonsensical, but that would account for the behavior the OP is talking about, now wouldn't it? Due to the lack of definite information, we are speculating on the possible causes of the problem, and that would definately case a problem.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Part of the complaint was that a second window was opening unwanted from this window with the same URL as this window. The window with the posted problem code is the popup. It's not an assumption that no further popups are wanted from this window (according to the original post), so changing the code to window.open would (most likely) worsen the problem.

Lee
 
If page A has window_onload handling and that it coded wrong in it to produce flickering, it is different from that page A has window_onload with a popup statement and that the popup page is malicious. The first is a mistake, the second is by design. Don't know what/why tsdragon and trollacious are taken thing.
- tsuji
 
We're even, I have no idea what you're talking about either. When did the mention of anything "malicious" happen? I thought we were talking about possible reasons why the OP's page loads, flickers for about 5 minutes, and then stops. I don't recall any mention of "malicious" code.


Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Hey guys, didn't mean to cause an uproar...hehehe..I took out the code and set up all the window properties in the parent page...which I should have done to begin with...Thanks for all your advice. Also, someone had mention that the code would cause endless pop-ups to occur...it actually did and I had to shut down my pc!

Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top