类似于“ http:// test:<a b="">&#34; is not getting displayed in text area in IE

时间:2018-11-22 05:38:23

标签: javascript user-interface internet-explorer

Anything given inside a tag is not getting displayed in a particular text area in IE.

example : http://test

1 个答案:

答案 0 :(得分:1)

您是说您完全写了 http://test,并且没有在标记内显示文本吗?在我这边,它显示在IE 11中。

示例代码:

<!DOCTYPE html>
<html>
<head>
<script>
function add_txt()
{
document.getElementById("t_area").value = "http://test:<a b>";

}
</script>
</head>
<body>

<textarea rows="4" cols="50" id="t_area">
 
</textarea>
<input type="button" value="add text" onclick="add_txt()">
</body>
</html>

输出:

enter image description here

它被重新识别为文本,因此可以显示。如果您尝试在textarea中添加HTML,则它将不会显示。这是所有浏览器的行为,而不仅仅是IE。

因此,如果您尝试添加文本,则一定会显示该文本。

您可以尝试使用上述代码进行测试。如果问题仍然存在,请尝试提供示例代码来产生问题。我会尝试对它进行测试。

相关问题