开发者

Unexpected behaviour while edting content in HTML text area with special charecters

Hi I am facing problem in handling special charecters inside text area.

<textarea name="comments" value="$!comments" rows="4" cols="35">
$!comments
</textarea>

In a page where the text are takes input had given as

o!@#$%^&*()_+=//\""':;<>,./?}{[]"?

when I na开发者_如何转开发vigate to same page for edit the Text area should show the added text but it is showing some appended tag information as

<>,./?}{[]"?." rows="4" cols="35" >o!@#$%^&*()_+=//\""':;<>,./?}{[]"?.

There is no reason for adding these special charecters except found in testing and so should be fixed. Please help


The browser sees this:

value=">,./?}{[]"?

and closes your textarea tag at value, then inserts the rest of the string.

If you want angle brackets < > you have to define HTML entities for them with &lt; and &gt;. Otherwise, the browser will thing "end of tag" and output the error you see above.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜