为什么头标记具有runat属性? [英] Why does the head tag have the runat attribute?
问题描述
我有任何与asp.net的经验。我刚开始学习asp.net MVC不通过web表单传递的。我确实有网络发展但PHP + codeigniter经验。
I have no experience whatsoever with asp.net. I'm just starting out with asp.net MVC without passing through webforms at all. I do have experience with web developing but with php+codeigniter.
什么是具有的团长我的HTML
标签?里面的 RUNAT
属性的目的
What's the purpose of having the runat
attribute inside the head
tag of my html?
我应该删除吗?
推荐答案
由于,如果您使用的母版页,你可以给自己更多的元数据添加到&LT的能力; HEAD&GT ;
标记通过添加runat属性。
Because, if you're using Master Pages, you can give yourself the ability to add further meta-data to the <head>
tag by adding the runat attribute.
它也用于注入到头部标记为ASP.NET AJAX的Javascript引用(和自定义脚本注入,你可能会在页面上通过create 的ScriptManager
)。
It's also used to inject Javascript references to the head tag for ASP.NET AJAX (and custom script injection that you might create on your page via ScriptManager
).
修改
由于意见所指出的那样,只有这样,你可以修改任何的&LT的内容; HEAD&GT;
组中的code。我列出了两个较为复杂的情况。
As the comments have pointed out, this is needed so that you can modify any of the contents of the <head>
group in your code. I listed two of the more complex scenarios.
这篇关于为什么头标记具有runat属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!