次のようなスクリプトタグを挿入するにはどうすればよいですか。
<script src="somejsfile"></script>
また
<script type="text/javascript>some javascript</script>
部分的なビューからページのヘッドタグに?
更新:古い質問への回答これはASP.NETMVCに関するものです。RenderSectionを使用できます。Razorビューエンジンを使用したMVC3のサンプルは次のとおりです。
レイアウトビューまたはマスターページ:
<html>
<head>
<script ...></script>
<link .../>
@RenderSection("head")
</head>
<body>
...
@RenderBody()
...
</body>
</html>
表示、例:ホーム:
@section head{
<!-- Here is what you can inject the header -->
<script ...></script>
@MyClass.GenerateMoreScript()
}
<!-- Here is your home html where the @RenderBody() located in the layout. -->