• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 819
  • Last Modified:

Urgent !!! On server side, call javascript from vb script.

Hi All,

I have server side javascript and vb script, while executing my page i have to call javascript function form vb script code and manuplate the display with the returned value.


Help me as this is an urgent.

Thanks,
Amit Jain

0
amit1978
Asked:
amit1978
3 Solutions
 
Ivo StoykovCommented:
Hello amit1978,

this just an idea

<%@ Language="VBScript"%>
<%
Sub myVB_Sub
...
End Sub
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
var myStrVar = '<%=myVB_Sub%>'; // if return value is string and
var myNumVar = <%=myVB_Sub%>; // if return value is number
//-->
</SCRIPT>
<BODY>

</BODY>
</HTML>


HTH

I
0
 
amit1978Author Commented:
Thanks,

But here we are calling vb script function thats ok, but my problem is......
Default language of my page is vbscript, and i have to call javascript function from the page. Where vbscript and javascript both are server side language.


Thanks,
Amit Jain
0
 
Ivo StoykovCommented:
Hi amit1978,

you can use only one language...

regards

I
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Ivo StoykovCommented:
Hi amit1978,

You could use Server.Transfer... to implement both languages into two different pages which will be executed and one streem.

regards

I
0
 
ullfindsmitCommented:
amit.... unless you compile the code into .dll files.... AFAIK they are not interoperable

hence if you started /inheritedin JScript... you will have to continue in JScritp

0
 
ThinkPaperCommented:
like the others said, you can't run javascript and ASP at the same time. Server scripting will always run before client scripting.
The closest you can come to doing that is calling a javascript FROM vbscript:

<%
If Request("Submit") Then
%>
<Script language="Javascript">
alert("Form has been submitted!");
</script>
<% End If %>


Or call a function passing an ASP value...

<a href="##" onclick="javaFunction("<%=myASPvariable%>");">Click ME</a>

Or BUILD a Javascript function using VBScript..

<script LANGUAGE="JavaScript">

function displayStuff(funnyValue)
{

<%
  response.write " if (funnyValue == 'happy') "
     response.write " alert(funnyValue); "
  response.write " else "
  response.write " alert('booo');"
%>
}
</script>
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now