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

Data Passing

Status
Not open for further replies.

parames

MIS
Jun 26, 2000
71
MY
How to pass values between javascript to vbscript.
i'm using javascript to do the validation in asp but inbetween this javascript i'm using vbscript to access data from database and then pass the values back again to javascript.
is it possible..please guide me..

please help
iswa
 
You could try placing the data to be passed between VBScript and JScript in an invisible form temporarily. Both VB and javascript can access this in read/write.

Hope this helps,
Tom
 
By the time javascript takes over, all the vbscript code would have already been interpreted. So, to pass a value from vbscript to javascript, you can just write it out with inline code:
var user = <%= objRS(&quot;username&quot;) %>;

To pass a value from javascript to vbscript, you can, as Tom suggested, pass it in a form variable or you can do it via a querystring.

Choo Khor
choo.khor@intelebill.com
 
Dear parames,

There is at least one article on MSDN that warns against using more than one scripting engine due to the overhead and order of execution.

Now if you want to do it anyway... you can return values from functions across engines like this:

<%@ language=javascript %>
<script language=vbscript runat=server>
function myVbFunc()
myVbFunc = 25
end function
</script>

<%
var someVal = myVbFunc();
Response.write(&quot;<p>&quot; + someVal + &quot;</p>&quot;);
%>

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top