Hi,

I ported the following code from MS's documentation, which
was written in JScript. It executes without error, but
the popup doesn't display. Anyone have any idears?

Alex B.

<Head>
<script language="vbscript">
sub ButtonClick()
dim oPopup
dim oPopBody

set oPopup = window.createPopup
set oPopbody = oPopup.document.body

oPopBody.innerHTML = "Help for <B>Test</B>
page..."

'This line produces nothing, but original
JScript works fine!
oPopup.show 100,100, 100, 100,
document.body

'This works fine
msgbox "Hi"
end sub
</script>
</HEAD>

<body>
<INPUT onclick="ButtonClick()" style="Z-INDEX: 108; LEFT:
41px; WIDTH: 169px; POSITION: absolute; TOP: 280px;
HEIGHT: 24px" type="button" value="Help" id="btnHelp">
</body>

Re: popup.show() no workie! by Michael

Michael
Mon Jul 07 18:23:29 CDT 2003

AlexB1318 wrote:
> Hi,
>
> I ported the following code from MS's documentation, which
> was written in JScript. It executes without error, but
> the popup doesn't display. Anyone have any idears?

Define the oPopup variable as a global, page-level variable outside any
sub/function, not as a local procedure variable.

If you don't, the popup object instance is released and destroyed when the
local oPopup variable goes out of scope...


> <Head>
> <script language="vbscript">

dim oPopup

> sub ButtonClick()

> dim oPopBody
>
> set oPopup = window.createPopup
> set oPopbody = oPopup.document.body
>
> oPopBody.innerHTML = "Help for <B>Test</B>
> page..."
>
> 'This line produces nothing, but original
> JScript works fine!
> oPopup.show 100,100, 100, 100,
> document.body
>
> 'This works fine
> msgbox "Hi"
> end sub
> </script>
> </HEAD>
>
> <body>
> <INPUT onclick="ButtonClick()" style="Z-INDEX: 108; LEFT:
> 41px; WIDTH: 169px; POSITION: absolute; TOP: 280px;
> HEIGHT: 24px" type="button" value="Help" id="btnHelp">
> </body>

--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Technet Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp

Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp


Re: popup.show() no workie! by Robert

Robert
Wed Jul 09 11:57:05 CDT 2003

shouldn't:
set oPopup = window.createPopup

be instead:
Set oPopu = WScript.CreateObject("WScript.Shell")


--
Sorry, I am no longer including my e-mail address as I am getting to much
spam. I really have no desire to enlarge "it" by three inches, that is even
if I get e-mailed 10 times a day from different e-mail addresses so I can't
block it.
Besides I finally came to believe what others have said, if you have a
question, you should ask the group as others might benefit from it. Anyone
on the group who I converse with off topic or on the side, can easily find
my e-mail address.


"AlexB1318" <abrambila@fresno.ca.gov> wrote in message
news:073801c344db$8ce04360$a101280a@phx.gbl...
> Hi,
>
> I ported the following code from MS's documentation, which
> was written in JScript. It executes without error, but
> the popup doesn't display. Anyone have any idears?
>
> Alex B.
>
> <Head>
> <script language="vbscript">
> sub ButtonClick()
> dim oPopup
> dim oPopBody
>
> set oPopup = window.createPopup
> set oPopbody = oPopup.document.body
>
> oPopBody.innerHTML = "Help for <B>Test</B>
> page..."
>
> 'This line produces nothing, but original
> JScript works fine!
> oPopup.show 100,100, 100, 100,
> document.body
>
> 'This works fine
> msgbox "Hi"
> end sub
> </script>
> </HEAD>
>
> <body>
> <INPUT onclick="ButtonClick()" style="Z-INDEX: 108; LEFT:
> 41px; WIDTH: 169px; POSITION: absolute; TOP: 280px;
> HEIGHT: 24px" type="button" value="Help" id="btnHelp">
> </body>
>



Re: popup.show() no workie! by Michael

Michael
Wed Jul 09 19:42:14 CDT 2003

Robert Cohen wrote:
> shouldn't:
> set oPopup = window.createPopup
>
> be instead:
> Set oPopu = WScript.CreateObject("WScript.Shell")

createPopup Method (window) (Internet Explorer)
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createpopup.asp

popup Object (Internet Explorer)
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/popup.asp


--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Technet Script Center
http://www.microsoft.com/technet/scriptcenter/default.asp

Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp


Re: popup.show() no workie! by Robert

Robert
Thu Jul 10 08:06:56 CDT 2003

see I am still learning many things. To be honest, I often even get
confused between popup and msgbox.

--
Sorry, I am no longer including my e-mail address as I am getting to much
spam. I really have no desire to enlarge "it" by three inches, that is even
if I get e-mailed 10 times a day from different e-mail addresses so I can't
block it.
Besides I finally came to believe what others have said, if you have a
question, you should ask the group as others might benefit from it. Anyone
on the group who I converse with off topic or on the side, can easily find
my e-mail address.


"Michael Harris (MVP)" <mikhar@mvps.org> wrote in message
news:eTu8pvnRDHA.2084@TK2MSFTNGP11.phx.gbl...
> Robert Cohen wrote:
> > shouldn't:
> > set oPopup = window.createPopup
> >
> > be instead:
> > Set oPopu = WScript.CreateObject("WScript.Shell")
>
> createPopup Method (window) (Internet Explorer)
>
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/createpopu
p.asp
>
> popup Object (Internet Explorer)
>
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/popup.asp
>
>
> --
> Michael Harris
> Microsoft.MVP.Scripting
> Seattle WA US
>
> Technet Script Center
> http://www.microsoft.com/technet/scriptcenter/default.asp
>
> Microsoft® Windows®2000 Scripting Guide
> http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp
>