用C#动态输出js单引号问题
<div id="cnblogs_post_body">一次在论坛上碰到某人需要动态用C#在后台输出&ldquo;我要'飞'&rdquo;的字符串&mdash;&mdash;其中&ldquo;飞&rdquo;上带有一对单引号。当时我就这样想&hellip;&hellip;在纯Html中js代码这样写:<div class="cnblogs_code"><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title></title> <script type="text/javascript"> function MyClick() { alert("OK"); alert('我要\'飞\''); } </script></head><body> <p> <input id="Button1" type="button" value="button" onclick="MyClick()" /> </p></body></html>
页:
[1]