Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Problem calling a function
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

paulnoe
Starting Member

USA
48 Posts

Posted - 13 August 2003 :  16:29:21  Show Profile  Visit paulnoe's Homepage
I am calling a javascript function from an asp page. The function is in a server-side include file.

The default language of the asp page that is calling the function is vbscript. For some reason, my asp page is viewing the function as a variable instead of calling the function and passing the arguments.

The code calling the function:

LoginStatus = ValidateUser(UserID, Password)

It is passing the proper values in the proper order. Any thoughts?

Thank you - Paul

Paul Noe
paul@thenoes.com

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 13 August 2003 :  18:11:41  Show Profile
afaik, you can't mix languages like that. you would need to turn the function into a vbscript function or find another creative way to do it.

Nikkol ~ Help Us Help You | ReadMe | 3.4.03 fixes | security fixes ~
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 13 August 2003 :  18:58:07  Show Profile
You can call js functions from VBS and vice-versa, and even to/from perlscript, although there are sometimes datatype problems between languages.

You have to use <script runat=server> .. </script> in your asp for code from the "foreign" language. <% %> delimeters only handle the default page language.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

D3mon
Senior Member

United Kingdom
1685 Posts

Posted - 13 August 2003 :  18:59:50  Show Profile  Visit D3mon's Homepage
The Javascript function won't actually exist when the ASP script is executed on the server. The ASP will send the Javascript to the browser, which will then be able to execute it later in the process, client-side.

Of course you could create server-side Javascript, but why bother when VBScript could do the job?


Snitz 'Speedball' : Site Integration Mod : Friendly Registration Mod
"In war, the victorious strategist only seeks battle after the victory has been won"

Edited by - D3mon on 13 August 2003 19:02:30
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 13 August 2003 :  20:28:55  Show Profile
quote:
The Javascript function won't actually exist when the ASP script is executed on the server. The ASP will send the Javascript to the browser, which will then be able to execute it later in the process, client-side.

Not really, you can write javascript to run on the server. Below is a very quick sample page that runs fine on IIS5.1

<%@ Language=VBScript %>
<%
Dim MyVar
MyVar = GetTheString("Test")
%>

<script language=javascript runat=server>
function GetTheString(ts) {
  ts = ts + " more stuff";
  return ts;
}
</script>

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>

<P> </P>
The script returned <% =MyVar %>

</BODY>
</HTML>


======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

paulnoe
Starting Member

USA
48 Posts

Posted - 14 August 2003 :  08:38:11  Show Profile  Visit paulnoe's Homepage
Thanks a bunch - I will take another look at how I'm mixing languages. I was worried about that.

Paul Noe
paul@thenoes.com
Go to Top of Page

CarKnee
Junior Member

USA
297 Posts

Posted - 14 August 2003 :  08:59:07  Show Profile  Visit CarKnee's Homepage
quote:
Originally posted by D3mon
Of course you could create server-side Javascript, but why bother when VBScript could do the job?



I thought the same thing until I wanted to use some date/time functions that do not exist in VBScript. For instance:
getUTCDate() and all the other UTC date/time functions


Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 14 August 2003 :  12:22:15  Show Profile
quote:
Originally posted by CarKnee

quote:
Originally posted by D3mon
Of course you could create server-side Javascript, but why bother when VBScript could do the job?



I thought the same thing until I wanted to use some date/time functions that do not exist in VBScript. For instance:
getUTCDate() and all the other UTC date/time functions




I think date/time stuff was what first got me on the js road too :)

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page

bjlt
Senior Member

1144 Posts

Posted - 14 August 2003 :  15:34:59  Show Profile
I did the same as no function in vbs is like getUTCDate() too.

Talking about vbs and js, I've run across another asp forum application and the author said in his next release vbscript is left mainly for communication with the db only and he'll use js mostly for all other staff, accroding to him it will be more efficient. I'm not sure about the difference of efficiency and how he'd calculated it. Maybe he's talking about more client side activity as his forum does not pay much attention on cross brower support, or is js really more efficient actually?
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 14 August 2003 :  20:40:59  Show Profile
From what I've read, vbs and js are similar in performance on windows asp platforms.

======
Doug G
======
Computer history and help at www.dougscode.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.36 seconds. Powered By: Snitz Forums 2000 Version 3.4.07