环境:Visual Studio 2008 SP1、ASP.NET 和 JavaScript
我正在尝试做一个快速 document.write
测试,但只要我添加脚本标签,Visual Studio 编辑器就不喜欢它。具体来说,结束脚本标签?我一进入收盘价就得到那些波浪线 </script>
标签
<html><head></head><body>
<script type='text/javascript'>
document.write('<html><head><script></script></head><body></body></html>');
</script>
</body>
</html>
最佳答案
使用:
document.write('<html><head><script><\/script></head><body></body></html>');
Note the `\`, here ------------------^
另一种选择是拆分字符串,这样它就不是一个精确的标签:
document.write('<html><head><script></sc' + 'ript></head><body></body></html>');
这里有一个解释为什么需要它的引用,以及其他选项:
不管怎样,你为什么要将整个文档写入 <body>
?
关于c# - 关闭脚本标记和 document.write 在 Visual Studio 中被标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16065816/