简体   繁体   English

CS1525:无效的表达式术语“ <”

[英]CS1525: Invalid expression term '<'

Using this code within an aspx file 在aspx文件中使用此代码

<% if(storeid=1) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer></script>
<% } %>
<% else if(storeid=2) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-efgh.js" async defer></script>
<% } %>
<% else if(storeid=3) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-ijklmn.js" async defer></script>
<% } %>
<% else if(storeid=4) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-opqrs.js" async defer></script>
<% } %>

Compiling this gives me this error 编译这个给我这个错误

Compiler Error Message: CS1525: Invalid expression term '<' 编译器错误消息:CS1525:无效的表达式术语“ <”

Source Error: 源错误:

Line 62:    
Line 63:    // Specific Code test 17.4.2014
Line 64: <% if(storeid=1) { %>
Line 65:    <script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer>   </script>
Line 66: <% } %>

All of the <% and %> look ok. 所有的<%和%>看起来都不错。 Where is it falling down? 它在哪里跌落?

它是storeid == 1 ,而不是storeid=1

Replace this line: 替换此行:

<% if(storeid=1) { %>

With: 带有:

<% if( storeid == 1 ) { %>

By the way, this is true for all of the rest equality checks in the other lines of code. 顺便说一下,这对于其他代码行中的所有其他相等检查都是正确的。

Your storeid='1' is wrong and the rest of your else statement. 您的storeid ='1'错误,其余的else语句。 it should be == . 它应该是==

storeid == 1 and not storeid=1 . storeid == 1而不是storeid=1

<% if(storeid=1) { %>

should be 应该

<% if(storeid==1) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-abcd.js" async defer></script>
<% } %>
<% else if(storeid==2) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-efgh.js" async defer></script>
<% } %>
<% else if(storeid==3) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-ijklmn.js" async defer></script>
<% } %>
<% else if(storeid==4) { %>
<script src="//d3c3cq33003psk.cloudfront.net/opentag-1234-opqrs.js" async defer></script>
<% } %>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM