why can't use \" in HTML input tag?
i want show 12"3
in my input tag value
i write this:
<INPUT TYPE="text" NAME="" value="12\"3">开发者_JAVA百科;
but it's not be right
WHY ?
PS: i must transfer "
to "
,or change "
to '
? i don't like it
HTML simply does not have escape sequences like other languages. In HTML attribute values the only special characters are <
, &
and depending on the quotes "
or '
. And the only to use these characters are character references:
Some authors use the character entity reference "
"
" to encode instances of the double quote mark ("
) since that character may be used to delimit attribute values.
Or you use single quotes, then you don’t need to encode the double quotes and vice versa:
<INPUT TYPE="text" NAME="" value='12"3'>
WHY ?
Because \
is not special in HTML. It does not escape stuff. You must use "
or '
.
<input type="text" name="somename" value='12"3' />
<input type="text" name="somename2" value="12"3" />
精彩评论