脚本标签与&​​amp; quot;<%....%& gt;"和标签? [英] What is the difference between script tag, and "<%....%>" tag?

查看:35
本文介绍了脚本标签与&​​amp; 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.

这篇关于脚本标签与&​​amp; quot;&lt;%....%&amp; gt;&quot;和标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆