How can i place valid link with get parameters into my page?
When i run validator, it gives error:
Line 37, Column 37: reference to entity "p" for which no system identifie开发者_StackOverflow中文版r could be generated
<li><a href="index.php?c=tutorials&p=cat&cid=1" >LINK</a></li>
from here http://css-discuss.incutio.com/wiki/Code_Validation
The most common error by far looks something like this: reference to entity "BV_Engine" for which no system identifier could be generated. What that means is simply that you've got a URL with an & sign in it that you forgot to escape.
For example:
<a href="script.cgi?id=4&BV_Engine=20">
The & sign in this URL should be &. In fact ALL & signs in an HTML document should be escaped in this way to avoid causing confusion to HTML parsers. For the above example, replacing it with
<a href="script.cgi?id=4&BV_Engine=20">
Escape your ampersands:
<li><a href="index.php?c=tutorials&p=cat&cid=1" >LINK</a></li>
You have to use & instead of plain &. Its an html entity.
<li><a href="index.php?c=tutorials&p=cat&cid=1" >LINK</a></li>
Yes, as the others have posted above, you need to escape your amparsands as & rather than &.
<li><a href="index.php?c=tutorials&p=cat&cid=1">LINK</a></li>
should work.
To be compatible with XHTML (and XML in general), the ampersand must be escaped. To do so requires the use of an SGML/XML entity.
There are three different entities that can be used to represent the ampersand:
Named entity:
&
(This is one of the five predefined entities defined in the XML specification.)Decimal numeric character reference:
&
Hexadecimal numeric character reference:
&
So, the value of your example href
attribute could be represented in one of these three ways:
href="index.php?c=tutorials&p=cat&cid=1"
href="index.php?c=tutorials&p=cat&cid=1"
href="index.php?c=tutorials&p=cat&cid=1"
Of course, it would be valid to mix the above entities like this:
href="index.php?c=tutorials&p=cat&cid=1"
^^^^^ ^^^^^
...but most would argue for taking a consistent approach throughout a document (and even an entire web site).
Of the three entities that can be used to represent the ampersand, I believe that &
is used most commonly in XHTML.
Final note: One of the above entities should also be used when authoring HTML, however browsers today do not require that the ampersand be escaped.
精彩评论