Я использую эту функцию для отображения карты с использованием виртуальной карты. когда я запускаю это я получаю исключение в выражении ожидается на <% if (b == 0) Then %>
, что я делаю неправильно Ниже мой Javascript код я объявил Dim b As Integer
ожидаемое выражение в функции javascript
<script type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2&s=1&mkt=en-us"></script>
<script type="text/javascript">
var myMap = null;
function LoadMap()
{
myMap = new VEMap("mapDiv");
myMap.LoadMap();
myMap.SetZoomLevel(1);
<% If RS.HasRows Then %>
<% if (b == 0) Then %>
StartGeocoding<%=b %>("<%= rs("lot_address") & " " & rs ("lot_city") %>, <%= rs("lot_state") & " " & rs("lot_zip")%>");
<% end if%>
function StartGeocoding<%=b%> (address)
{
myMap.Find(null, // what
address, // where
null, // VEFindType (always VEFindType.Businesses)
null, // VEShapeLayer (base by default)
null, // start index for results (0 by default)
null, // max number of results (default is 10)
null, // show results? (default is true)
null, // create pushpin for what results? (ignored since what is null)
null, // use default disambiguation? (default is true)
<%if(b==0) Then %>
null, // set best map view? (default is true)
<%else%>
false, // set best map view? (default is true)
<%end if%>
GeocodeCallback<%= b %>); // call back function
}
function GeocodeCallback<% =b %> (shapeLayer, findResults, places, moreResults, errorMsg)
{
// if there are no results, display any error message and return
if(places == null)
{
alert((errorMsg == null) ? "There were no results" : errorMsg);
return;
}
var bestPlace = places[0];
// Add pushpin to the *best* place
var location = bestPlace.LatLong;
var newShape = new VEShape(VEShapeType.Pushpin, location);
var desc = "<%=rs("lot_address")%><br /><%=rs("lot_city")%>, <%=rs("lot_state")&" "&rs("lot_zip")%><br /><br /><a href='lot.asp?id=<%=rs("id")%>' class='link' style='color:black;'><strong>» Get More Details & Rates</strong></a>";
newShape.SetDescription(desc);
newShape.SetTitle("<%=rs("lot_name")%>");
myMap.HideInfoBox();
myMap.AddShape(newShape);
myMap.HideInfoBox();
<%rs.movenext
if RS.HasRows Then
if (b==1) then%>
myMap.ZoomOut();
<%end if%>
StartGeocoding<%=b+1%>("<%=rs("lot_address")&" "&rs("lot_city")%>, <%=rs("lot_state")&" "&rs("lot_zip")%>");
<%else
%>
myMap.ZoomOut();
<%end if
// rs.moveprevious :
%>
myMap.HideInfoBox();
}
<%
b=b+1
rs.read
loop
rs.
%>
myMap.HideInfoBox();
}
function UnloadMap()
{
if (myMap != null) {
myMap.Dispose();
}
}
</script>
как насчет '<% if b = 0 Then%>'? – har07