Board index » Web Programming » elementary problem in ASP programming involving IIS+VBScript

elementary problem in ASP programming involving IIS+VBScript

Web Programming129
I don't have, and haven't found, a decent VBScript for ASP programming

reference.



Please consider this fundtion:



function ShowProduct(inVal)

{

location.href = 'ProductInfo.asp?ProductID=' + inVal;

}



I need to change it so that instead of displaying the page due to the

hyperlink in the current window, it is displayed in a new window (of which

there can only be one non-modal instance.



I believe I need something like:

dim win = window.open(url,'theProductWindow', ...);

win.focus();



where url would be given the value assigned in the function to location.href



But it has been such a long time, I don't remember the details.



And, while the way they're used suggests to me that location and window are

system objects, defined by default, I have not yet found any documentation

for them.



Can anyone a) given me an url that points to a decent VBScript manual,

and/or b) show me some sample VBScript code that opens a new window that

displays the page pointed to by a hyperlink, and for which there is only

ever one instance and which is non-modal?



Thanks,



Ted


-
 

Re:elementary problem in ASP programming involving IIS+VBScript



"Ted Byers" <r.ted.byers@sympatico.ca>wrote in message

Quote
I don't have, and haven't found, a decent VBScript for ASP programming

reference.



Please consider this fundtion:



function ShowProduct(inVal)

{

location.href = 'ProductInfo.asp?ProductID=' + inVal;

}



I believe I need something like:

dim win = window.open(url,'theProductWindow', ...);

win.focus();



where url would be given the value assigned in the function to

location.href



But it has been such a long time, I don't remember the details.



This isn't anything to do with IIS or ASP - you're wanting a client side

VBscript



In fact, your example above is in Javascript!



To open a window, wth a URL defined in ASP :



<% sURL = "myPage.asp?var=" & Request.Form("WhateverValue") %>



<script language = vbscript>

window.open "<%=sURL%>",'Win2'

</script>







-

Re:elementary problem in ASP programming involving IIS+VBScript

On Mon, 5 Jan 2004 12:13:48 -0500, "Ted Byers"

<r.ted.byers@sympatico.ca>wrote:



Quote
I don't have, and haven't found, a decent VBScript for ASP programming

reference.



Might try:



www.devguru.com/Technologies/vbscript/quickref/vbscript_intro.html">www.devguru.com/Technologies/vbscript/quickref/vbscript_intro.html



Quote
Please consider this fundtion:



function ShowProduct(inVal)

{

location.href = 'ProductInfo.asp?ProductID=' + inVal;

}



I need to change it so that instead of displaying the page due to the

hyperlink in the current window, it is displayed in a new window (of which

there can only be one non-modal instance.



Well, it isn't ASP and it isn't an IIS issue. It's client-side code,

try a JavaScript group.



Quote
Can anyone a) given me an url that points to a decent VBScript manual,

and/or b) show me some sample VBScript code that opens a new window that

displays the page pointed to by a hyperlink, and for which there is only

ever one instance and which is non-modal?



Of course, you might also want to browse MSDN's DHTML reference,

starting somehwhere around here might help...



http://msdn.microsoft.com/library/default.asp?url" rel="nofollow" target="_blank">msdn.microsoft.com/library/default.asp=/workshop/author/dhtml/reference/methods/showmodaldialog.asp



Jeff

-

Re:elementary problem in ASP programming involving IIS+VBScript



"Dan Boylett" <parc_erom@crossdata.co.uk>wrote in message

Quote


"Ted Byers" <r.ted.byers@sympatico.ca>wrote in message

news:e3lpi$60DHA.2528@TK2MSFTNGP09.phx.gbl...

>I don't have, and haven't found, a decent VBScript for ASP programming

>reference.

>

>Please consider this fundtion:

>

>function ShowProduct(inVal)

>{

>location.href = 'ProductInfo.asp?ProductID=' + inVal;

>}

>

>I believe I need something like:

>dim win = window.open(url,'theProductWindow', ...);

>win.focus();

>

>where url would be given the value assigned in the function to

location.href

>

>But it has been such a long time, I don't remember the details.



This isn't anything to do with IIS or ASP - you're wanting a client side

VBscript



In fact, your example above is in Javascript!



OOPS! I had assumed that since the file containing this had an ASP

extension that everything in it dealt wth ASP programming, and that since

most of the asp files in this project have a line at the top identifying the

script as VBScript, that ASP prgramming in VBScript was all I was dealing

with.



There is, alas, no documentation for this project (which I have only been

asked to modify - one of the code, yet, is mine).



Is it normal to mix VBScript, JScript and ASP all in one file? How do you

tell the difference when it is all mixed together?



Quote
To open a window, wth a URL defined in ASP :



<% sURL = "myPage.asp?var=" & Request.Form("WhateverValue") %>



<script language = vbscript>

window.open "<%=sURL%>",'Win2'

</script>



Now this looks strange. You can actually have a function call with

arguments that aren't surrounded by parentheses?



Thanks for your help.



Cheers,



Ted





-

Re:elementary problem in ASP programming involving IIS+VBScript

Hi Jeff,



Thanks for the links.



As I explained to Dan, I thought it was VBScript and ASP since I found the

code in a file with an ASP extension in a project making considrable use of

VBScript and asp (and all of the code is in asp files, most of which have on

the first line a reference to VBScript). I wasn't aware that you could, or

should, mix client side code with server side code in the same file, or that

you could or should mix JScript with VBScript. I guess it only shows my

inexperience with these scripting languages and ASP.



Thanks again,



Ted



"Jeff Cochran" <jcochran.nospam@naplesgov.com>wrote in message

Quote
On Mon, 5 Jan 2004 12:13:48 -0500, "Ted Byers"

<r.ted.byers@sympatico.ca>wrote:

[snip]





-

Re:elementary problem in ASP programming involving IIS+VBScript



"Ted Byers" <r.ted.byers@sympatico.ca>wrote in message

Quote
OOPS! I had assumed that since the file containing this had an ASP

extension that everything in it dealt wth ASP programming, and that since

most of the asp files in this project have a line at the top identifying

the

script as VBScript, that ASP prgramming in VBScript was all I was dealing

with.



The line at the top will look something like

<%@ language = vbscript>



This is a directive to the IIS server that this ASP pages uses VBScript.

Any further ASP code will then be contained in <% %>tags.

The <% %>idenity it as code that needs to be run by the server.



Client side scripts are contained in <script></script>blocks - and are

processed on the client.

Quote


Is it normal to mix VBScript, JScript and ASP all in one file? How do you

tell the difference when it is all mixed together?



It's not common (or good practice) to mix and match which language you use

for SERVER side scripting. Most cases VBScript is used, but some people

do use JScript.



Client side scripting can vary, depending on your target market - if it's

all IE then VBscript can work, but Jscript has somethings that are

easier/not in VBscript.



I use VBScript for Server side, and JScript/Javascript for client.



Quote
>To open a window, wth a URL defined in ASP :

>

><% sURL = "myPage.asp?var=" & Request.Form("WhateverValue") %>

>

><script language = vbscript>

>window.open "<%=sURL%>",'Win2'

></script>

>

Now this looks strange. You can actually have a function call with

arguments that aren't surrounded by parentheses?



Well there is a mistake in it, but it isn't the brackets - it's the single

quotes.



With VBscript, you don't need to use brackets, unless you're assigning a

value. So if you wanted a handle to the window it would be :



myWin = window.open("<%=sURL%>","Win2")







-

Re:elementary problem in ASP programming involving IIS+VBScript



"Ted Byers" <r.ted.byers@sympatico.ca>wrote in message



Quote
As I explained to Dan, I thought it was VBScript and ASP since I found the

code in a file with an ASP extension in a project making considrable use

of

VBScript and asp (and all of the code is in asp files, most of which have

on

the first line a reference to VBScript). I wasn't aware that you could,

or

should, mix client side code with server side code in the same file, or

that

you could or should mix JScript with VBScript. I guess it only shows my

inexperience with these scripting languages and ASP.



Sometimes it's essential to mix server side VBScript with client Jscript

(using the values from the server!).



It all depends on what you are doing.



As I mentioned in my other post, stuff between <% %>is always server side.



Stuff in <Script>tags is client side.



Until you get to ASP.Net at any rate...







-

Re:elementary problem in ASP programming involving IIS+VBScript

Thanks Dan,



Thanks for the clarification you provided in your last two posts. It is

greatly appreciated.



Cheers,



Ted





-