vbscript syntax in asp classic

2019-07-21 13:50发布

问题:

I have a vbscript that I want to run in the <head> of an asp. I am having trouble getting the script to run so I'm thinking I need some help making sure the asp knows that it's vvbscript or something. The last script is the one I am having trouble running.

here is what I have:

<%@ Language=VBScript %>
<%

    ***vbscript***

%>
<HTML>
<HEAD>
<link rel="stylesheet" href="MD_intstyle.css" type="text/css">
<SCRIPT Language="JavaScript">

     ***javascript***

</script>

<script language="vbscript">
     ***vbscript I am trying to run***
</script>

</HEAD>

回答1:

Change:

 <script language="vbscript">
 ***vbscript I am trying to run***
 </script>

To:

<%
***vbscript I am trying to run***
%>

AS(erver)P runs on the server and therefore you cant tell the client to run the code as vbscript with HTML-tags. Start your ASP code with the start tag <% and the close tag %>. Just as you do on the top in your example.



回答2:

use runat="server" in script tag.

 <script language="vbscript" runat="server">
      ***vbscript I am trying to run***
 </script>