<%if%><%else%>问题..
小弟我对下面的代码有点问题,为什么 <%if%> <%else%> 语句可以控制 <%%> 外面的空间是否显示啊.哪位高人给讲讲解下原理是怎么回事?小弟一直认为 <%%> 里面的东西对外面的代码没影响.向大虾们学习了。.
<%if(true)%>
<%{%>
<asp:TextBox id= "Textbox2 " style= "Z-INDEX: 101; LEFT: 240px; POSITION: absolute; TOP: 88px " runat= "server "> </asp:TextBox>
<asp:Button id= "Button2 " style= "Z-INDEX: 102; LEFT: 256px; POSITION: absolute; TOP: 128px " runat= "server " Text= "Button "> </asp:Button>
<SELECT style= "Z-INDEX: 103; LEFT: 272px; WIDTH: 176px; POSITION: absolute; TOP: 184px ">
<OPTION selected> </OPTION>
</SELECT>
<%}%>
<%else%>
<%{%>
<asp:TextBox id= "Textbox3 " style= "Z-INDEX: 101; LEFT: 240px; POSITION: absolute; TOP: 88px " runat= "server "> </asp:TextBox>
<SELECT style= "Z-INDEX: 103; LEFT: 272px; WIDTH: 176px; POSITION: absolute; TOP: 184px ">
<OPTION selected> </OPTION>
</SELECT>
<%}%>
[解决办法]
不要被表面现象蒙蔽,
经编译器解析后,会将页面所有的 <% %> 内有连编成一体