在id为head的内容占位符中编写脚本和在实际内容占位符(即内容占位符1)中编写脚本之间有什么区别? [英] what is the difference between writing the script in content place holder whose id is head and writing script in actual content placeholder i.e content placeholder 1 ?

查看:216
本文介绍了在id为head的内容占位符中编写脚本和在实际内容占位符(即内容占位符1)中编写脚本之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii,



当我们创建母版页时,两个内容占位符自动出现..一个是头部,另一个是内容占位符一个..

在id为head的内容占位符中编写脚本和在实际内容占位符中编写脚本(即内容占位符1)之间的区别是什么?




在我的项目中有很多脚本是用第一名持有者写的,有些是在其他占位符中...我只是想知道区别

解决方案

< blockquote>没有区别IMO。 根据MSDN,ContentPlaceHolder为ASP.NET母版中的内容定义区域页面 [ ^ ]



因此,当您创建母版页时,默认情况下会创建两个内容占位符,一个用于head section&另一个基于传统HTML文档(具有头部和身体)的身体部分。在过去,我们在头脑和头部都写过javascripts。身体部分,还记得吗?这里的CPH也以同样的方式行事。而已。无论如何,请了解有关ContentPlaceHolder的更多信息。顺便说一句,你可以在同一页面创建更多内容占位符,这取决于你的要求。


hii ,

whenver we create a master page two content place holders comes automatically .. one is head and other is contentplaceholder one ..
what is the difference between writing the script in content place holder whose id is head and writing script in actual content placeholder i.e content placeholder 1 ?


in my project there are lots of scripts are written in first place holder and some are in other placeholder ... i just want to know the difference

解决方案

No difference IMO. As per MSDN, ContentPlaceHolder defines a region for content in an ASP.NET master page[^]

So when you create a master page it creates two contentplaceholders by default, one for head section & another one for body section based on traiditional HTML document(which has head & body). In past, we have written javascripts in both head & body sections, remember? here CPHs also acting the same way. that's it. Anyway learn more about ContentPlaceHolder for more details. BTW you could create more contentplaceholders in same page, it depends on your requirement.


这篇关于在id为head的内容占位符中编写脚本和在实际内容占位符(即内容占位符1)中编写脚本之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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