Yes, you can make that work, however there are potential problems and perfomance issues with running both scripting engines in the same page. There are MSDN articles about that issue that you might want to read.
Without knowing specifically what you want to do here is a generic example:
<%@ language=javascript %>
<SCRIPT LANGUAGE=vbscript RUNAT=Server>
DIM g_name
function vb_getName()
if "" = g_name then g_name = "VB Variable"
vb_getName = g_name
end function
</SCRIPT>
<BODY>
<% var sVbName = vb_getName(); %>
VB Variable from javascript: <%=sVbName%>
Actually there is a simple method I used in various forms on my site. All you have to do is create a hidden text field in a form. Then in your initial asp script at the top of the page, get whatever value you need from your recordset and place this value in the hidden field with standard response.write or <% = rs('Columnname') %>.
In your Javascript function, just refer to the document.formname.fieldname.value.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.