======================================================
注:本文源代码点此下载
======================================================
html超链接地址中 "&" 符号可能导致的问题
众所周知, "&" 符号在html中要用实体,表示为 "&"。那么,超链接中的"&"符号呢?
当我们用 http://validator.w3.org/ 验证html文件的格式的时候, 可以明确的得到答复:
& did not start a character reference. (& probably should have been escaped as &.)
没有通过验证.
在 http://www.htmlhelp.com/tools/validator/problems.html#amp, 上我们可以到找答案:
another common error occurs when including a §ion=2©=3&lang=en">...
this example generates an error for "unknown entity section" because the "&" is assumed to begin an entity reference. browsers often recover safely from this kind of error, but real problems do occur in some cases. in this example, many browsers correctly convert ©=3 to ©=3, which may cause the link to fail. since 〈 is the §ion=2©=3&lang=en">...
note that replacing & with & is only done when writing the section=2©=3" 解释成 section=2@=3". 那么最终用户点击这个链接,打开的页面路径就是错的.服务器端接收到的 section的值不是2, 而是 2@=3.当url中的参数名以html实体命名时, 都会发生这个错误, 如 〈 © 等.这个情况出现在包括ie6-8(9?)以及opera在内的浏览器中.标签: html, w3c validator, w3c验证
绿色通道:好文要顶关注我收藏该文与我联系
posted @ 2011-10-13 23:19 温晚 阅读(252) 评论(0)编辑 收藏
======================================================
在最后,我邀请大家参加新浪APP,就是新浪免费送大家的一个空间,支持PHP+MySql,免费二级域名,免费域名绑定 这个是我邀请的地址,您通过这个链接注册即为我的好友,并获赠云豆500个,价值5元哦!短网址是http://t.cn/SXOiLh我创建的小站每天访客已经达到2000+了,每天挂广告赚50+元哦,呵呵,饭钱不愁了,\(^o^)/