Home  >  Article  >  Web Front-end  >  How to output tag in JavaScript_javascript skills

How to output tag in JavaScript_javascript skills

WBOY
WBOYOriginal
2016-05-16 16:38:321475browse

When '' pops up in How to output tag in JavaScript_javascript skills, How to output tag in JavaScript_javascript skills will mistakenly think that this is a closing tag, and an exception will occur.

Such as the following code

We used alert to pop up the '' string within the <script> block, but it was mistaken for an end tag and VIM changed color. Running results</script>

How to output </script> tag in JavaScript_javascript skills

Because the string is regarded as the end tag, an exception occurs. Obviously this is not the result we want. We just need to process the code a little bit to achieve it.

Use the plus sign to link the string in '', '' 'ipt>' and see the results

The program is normal and the string '' pops up correctly. In How to output tag in JavaScript_javascript skills, if the string uses a plus sign, it equals connection, and the number uses a plus sign, which equals addition.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn