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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.open

Status
Not open for further replies.

AgentM

MIS
Jun 6, 2001
387
US
Can somebody please tell me what is wrong with this code
<Script language=vbscript>
Dim varWin
varWin = window.open(&quot;load.htm&quot;, &quot;Loading data&quot;, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)

</Script>

Thank you
 
it's javascript, that's the main thing I see wrong with it [smile]

change the vbscript to javascript _______________________________________________
{ str = &quot;sleep is good for you. sleep gives you the energy you need to function&quot;;
ptr = /sleep/gi;Nstr = str.replace(ptr,&quot;coffee&quot;);alert(Nstr); }

_______________________________________________
for the best results to your questions: FAQ333-2924

 
Basically what I am trying to do is open a popup window and then close it after some time using VbScript

Any suggestions.
 
No I can't, There is some processing to be done then the window will close. So I don't know how long it will take.

But does somebody know what's wrong with the code or what is it's right version in VB Script
window.open(&quot;load.htm&quot;, &quot;Loading data&quot;, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)


Thanks
 
The second parameter is not the title but the target window (Note that this works identically to the TARGET attribute of an HREF in HTML) so you can not use spaces so Loading data is invalid it should be Loadingdata

window.open(&quot;load.htm&quot;, &quot;Loadingdata&quot;, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)
 
Hello AgentM,

You have at least to make varWin known as an object:
Code:
     Set varWin=window.open(etc...)
regards - tsuji
 
Supplementary Note:

Then, you might try to set the window's attribute first before assign its name, ie, leaving the &quot;Loading Data&quot; undefined at the time of creation of it.
Code:
Set varWin=window.open(&quot;load.htm&quot;, 1, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)
varWin.Name=&quot;Loading data&quot;
-tsuji
 
sorry about my last Reply in vbscript you do not have to assign it to an object you could simply omit 'window.' leave you with

open(&quot;load.htm&quot;, &quot;Loadingdata&quot;, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)

note if you use the 'window.' you must assign it to a variable since vbscript only have one data type it need not be and object which leaves you with

dim mWin
mWin = window open(&quot;load.htm&quot;, &quot;Loadingdata&quot;, &quot;height=200,width=400,status=yes,toolbar=no,menubar=no,location=no&quot;)

note if you do not use option explicit you can omit the line dim mWin
 
Hello MasterMind3,

I did not pay attention to the date of the original post, so my postings did not do any useful purpose in the current sense. Just a couple of further remarks some of which may interest you and please feel free to contradict me.

[1] Do not know why---there must be some web-legend that I see a couple of postings saying window.open is javascript. It is not.
[2] window.open does create an object. So if one is interested in dealing further with that particular object, one does need to set it up properly with
Code:
     Set oWin = window.open ([url, [name, [feature]]])
[3] If no immediate interest in calling upon the object so created, you can, as you suggest,
Code:
     window.open [url, [name, [feature]]]
with the only detail that you _should_ not enclose the parameters with the parentheses (). Doing so, it would fail.
[4] Just like some top level object app or window, one can spare to call it explicitly, as you suggested. But again, including the parenthese would defeat it.
[5] I only blame the parsing feature that if the name include space (even enclosed in quot&quot;&quot;), the .open fails. That is really bad, and might be considered as a bug. So if the default property name of the window so open containing space, it is much better, as I suggested, to make it in 2 steps:
Code:
     Set oWin = window.open (url,vbNull,feature)
or   Set oWin = window.open (url,&quot;&quot;,feature)
then set its name
Code:
     oWin.Name = &quot;xyz abc&quot;
[6] Name does matter if another child window already opened being named the same, no new window will be created. The browser will take that named window to display the thing instructed.

So these are my random remarks which may be interesting to some.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top