Code: Select all
<html>
<head>
<title>IE preformatted text sucks</title>
</head>
<body>
<pre id="test">
a b c
d e f
</pre>
<script type="text/javascript"><!--
var textContent = document.getElementById("test").innerText;
textContent = textContent.replace("a", "<span style=\"color:red;\">a</span>");
document.getElementById("test").style.whiteSpace = "pre";
document.getElementById("test").innerHTML = textContent;
--></script>
</body>
</html>Anyone know that solution that DOESN'T involve replacing the whitespace with HTML <br> etc? I don't want to have to encode all spaces, tabs and newlines into HTML since that defies the point of the <pre> tag
I really hate IE