什么是脚本标记之间的差异,并与QUOT;&LT;%...%GT;&QUOT;标签? [英] What is the difference between script tag, and "<%....%>" tag?
问题描述
我刚开始在Web应用程序工作,并学习使用ASP.Net。我所遇到的两种方法在HTML页面中添加脚本。一种是使用脚本标记,另一种是通过使用&LT;%...%GT;
标记。但是,我无法弄清楚,什么是两者之间的区别,哪一个我应该美元,其中字母p $ PFER?
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标签用于指定全脚本(通常是完整的方法/功能)(主要是客户端脚本,但你也可以拥有服务器端脚本块),而&LT;%...%方式&gt;
用于包括服务器端内嵌片段
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.
这篇关于什么是脚本标记之间的差异,并与QUOT;&LT;%...%GT;&QUOT;标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!