脚本标签与& quot;<%....%& gt;"和标签?
我刚刚开始研究Web应用程序,并学习使用ASP.Net.我遇到了两种在HTML页面中添加脚本的方法.一种是使用脚本标签,另一种是使用<%...%>
标签.但是,我无法弄清楚两者之间有什么区别,在这种情况下应该选择哪一个?
I have just started to work on web applications, and learning to use ASP.Net. I have come across two methods to add script in an HTML page. One is by using script tag, and other one is by using <% ... %>
tag. But, I am unable to figure out, what is the difference between both, and which one should I prefer in which case?
script标签用于指定完整脚本(通常是完整的方法/功能)(通常是客户端脚本,但您也可以具有服务器端脚本块),而<%...%>
用于包含服务器端内联代码段.
The script tag is used to specify full scripts (usually complete methods/function) (mostly client side scripts but you can also have server side script blocks) while the <% ... %>
are used to include server side inline snippets.