我可以放置< script>< / script>里面< script>< / script> [英] Can I place <script></script> inside <script></script>

查看:94
本文介绍了我可以放置< script>< / script>里面< script>< / script>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我需要在一些脚本标签中加载一个包含在一组脚本标签中的广告是否可能? 当你使用< script> HTML标记时,里面的内容被视为带引号(字面)的字符串,所以内部< / script> 标签里面被视为结束标签而不是字符串的一部分。所以你不能直接在脚本部分使用标签。



如果你必须,user2310289的方法是有效的,或者你也可以使用字符串连接 -

例如:
< / sc+ript>);


So I need to load a advert contained in a set of script tags inside some script tags is it possible ?

解决方案

When you use a <script> HTML tag what is inside is treated as a quoted (literal) string, so the inner </script> tag inside is treated as a closing tag rather than as a portion of the string. So you cannot directly use the tag inside a script section.

If you must, user2310289's approach is valid or you could also use string concatenation -
eg: "</sc"+"ript>");

这篇关于我可以放置&lt; script&gt;&lt; / script&gt;里面&lt; script&gt;&lt; / script&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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