消息通过表单提交。它可以包含html以及普通文本。
IE:
Why this code doesn't work for me?
<script type="text/javascript">
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-XXXXX-X']);
    _gaq.push(['_trackPageview']);
    (function() {
        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
</script>
我想用pre标签包围html元素。
IE
Why this code doesn't work for me?
<pre>
    <script type="text/javascript">
        var _gaq = _gaq || [];
        _gaq.push(['_setAccount', 'UA-XXXXX-X']);
        _gaq.push(['_trackPageview']);
        (function() {
            var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
            ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
            var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
        })();
    </script>
</pre>
我之前在 php 聊天室中询问过这个问题,这个问题的答案的作者建议阅读解决方案:php DOMDocument: complete transform of form element? 包装和去除?
在这个例子中一切都是完美的,除了几件事。我需要包装任何显然 exept 的 html 元素pre。  
- 如果元素被折叠,则仅包裹外部元素。
- 如果它们是分开的,则将它们各自包装起来。
- 如果只有打开标签,则只包装它(无需使用关闭标签修复)。
有没有人对这个问题的解决方案有任何可能的想法?提前感谢所有可以提供帮助的人。