问题
I followed Martha's suggestion here: if page is default then include if not default then And I am missing something, as I can't get it to display the slider.
Here is the slider code, and how I am using Martha'e suggestion.
This is the slider (bootstrap carousel) code (to be integrated with Martha's suggestion)
<div class="jumbotron">
<div class="container">
<div class="row fz-slider-wrap">
<div class="col-md-4 fz-slider-caption">
DFD Fioriere
</div>
<div class="col-md-8 fz-slider-image">
<div id="fz-gallery-slider" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#fz-gallery-slider" data-slide-to="0" class="active"></li>
<li data-target="#fz-gallery-slider" data-slide-to="1"></li>
<li data-target="#fz-gallery-slider" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img class="fz-img-box" src="images/slider/03.jpg" alt="slider 1" />
</div>
<div class="item">
<img class="fz-img-box" src="images/slider/01.jpg" alt="slider 2" />
</div>
<div class="item">
<img class="fz-img-box" src="images//slider/06.jpg" alt="slider 3" />
</div>
</div>
</div>
</div>
</div>
</div>
</div><!-- .jumbotron -->
This is what happens: If I put the above code inside
<%
Sub DisplaySlider()
slider code
%>
<%
End Sub
%>
I get this error when loading default.asp
Microsoft VBScript compilation error '800a0400'
Expected statement
/afz_includes/jumbotron.asp, line 3
If I wrap slider code in ' I get same error but line 4 If I wrap slider code in " I get same error (line 3) I also tried to wrap each line of slider code with ", and chnaged the " of classes and ids to ', but keep getting th error.
Here is what I put on the default.asp, and the other pages
<!-- #include virtual="/afz_includes/slider.html" -->
<%
scriptname = Request.ServerVariables("Script_Name")
If InStr(scriptname, "default.asp") > 0 Then
DisplaySlider
Else
Response.Write "<div class='fz-v-spacer-top'></div>"
End If
%>
I am not sure if it was a typo, anyhow I tried to save the slider both as html, and asp, but same error.
回答1:
It looks like you've put the slider's code inside the ASP code delimiters (the <%
and %>
), so the compiler is trying to treat it as VBScript, which it obviously isn't.
In ASP classic, you put your server-side VBScript code inside <% %>
blocks. HTML code does not go inside those blocks, unless you're Response.Write
-ing it.
<%
Sub DisplaySlider()
%>
<div class="jumbotron">
<div class="container">
...
</div>
</div><!-- .jumbotron -->
<%
End Sub
%>
来源:https://stackoverflow.com/questions/35633558/asp-conditional-include-error-microsoft-vbscript-compilation-error-800a0400