[英]In ASP how do I call a JavaScript function in one .asp file from another .asp file written in VB?
I have an .asp file with all of my javascript functions. 我所有的javascript函数都有一个.asp文件。 incConnectionCloud.asp
incConnectionCloud.asp
<html>
<head>
<Script language="JavaScript" type="text/javascript">
CCTokenRefresh = function() {
Do java stuff...
}
</Script>
I have a master asp page, RTNWBrowse.asp, written mostly in VB in which I want to call the javascript function CCTokenRefresh(). 我有一个主要的ASP页面RTNWBrowse.asp,主要用VB编写,我想在其中调用javascript函数CCTokenRefresh()。
If sAPITokenExpDate < Now Then
Call CCTokenRefresh()
End If
I get the following error when I load the main asp page with the VB code. 使用VB代码加载主ASP页面时,出现以下错误。
Variable is undefined: 'CCTokenRefresh' /RTNWBrowse.asp, line 119 变量未定义:“ CCTokenRefresh” /RTNWBrowse.asp,第119行
Your JScript file should look like this: 您的JScript文件应如下所示:
<SCRIPT LANGUAGE=JScript RUNAT=SERVER>
/* JScript code here */
</SCRIPT>
Then in your VBScript file you can include the JScript file with: 然后,在您的VBScript文件中,可以将JScript文件包含在以下内容中:
<!-- #include file="incConnectionCloud.asp" -->
Now you can simply call the JScript functions from VBScript. 现在,您可以简单地从VBScript调用JScript函数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.