更新时间:2023-12-05 21:36:58
有两个想法,假设页面本身是ASP.NET页面(而不是普通的HTML页面):
Two ideas come to mind, assuming the page itself is an ASP.NET page (and not a plain HTML page) :
script
标签和结束标签.通过使用自定义控件,您将使IDE愚弄不知道script
标记,因此将获得与封闭页面的HTML相同的语法颜色script
tag and end-tag. By using a custom control, you'll fool the IDE into not knowing about the script
tag, and so you'll get the same syntax coloring as the enclosing page's HTML我更喜欢第一种选择,因为它不会强迫您将页面分成多个文件.
I like the first option better, as it doesn't force you to split your page into multiple files.
如果它是纯HTML页面,则没有很多简单的方法可以做到这一点.如果不容易"是可以的,则可以通过创建一个 HttpModule ,它会在输出给用户后,用真实的text/html脚本标签替换源代码中的占位符标签(例如<myscript>
).
If it's a plain HTML page, there's not many easy ways to do this. If "not easy" is OK, then you can alwasy create an HttpModule which replaces a placeholder tag in the source code (e.g. <myscript>
) with, upon output to the user, a real text/html script tag.