【发布时间】:2011-11-07 20:45:11
【问题描述】:
我很困惑什么时候应该使用 & 什么时候应该使用 &,特别是当它在 HTML 中的 Javascript 中时。
这两个 URL 中的哪一个(或两者都或都不)应该使用 html 编码?
<!-- Example 1 -->
<script type='text/javascript'>
var myUrl = "myurl.html?bob=2&mary=3"; // or is it &?
downloadUrl(myUrl);
</script>
<!-- Example 2 -->
<p>Click <a href="myurl.html?bob=2&mary=3">here</a> <!-- &? --> if the download doesn't start.</p>
【问题讨论】:
标签: javascript html html-entities web-standards standards-compliance