Need a small improvement in this function
<p>I found a great script in one of the posts. That is working like a charm in Mozilla and Chrome, but in Internet&nbsp;Explorer it is working partially (only text without HTML tags in original html are matching...). Here I am attaching an image to show the same:</p>

<p><img src="http://i.stack.imgur.com/4KCcS.jpg" alt="Here is the image">.</p>

<p>I want to search for a string in a window and highligh it if found by considering the text in textbox as input. The script and fiddle I found are:</p>

<pre><code>function doSearch(text) {
    if (window.find &amp;&amp; window.getSelection) {
        document.designMode = "on";
        var sel = window.getSelection();
        sel.collapse(document.body, 0);

        while (window.find(text)) {
            document.getElementById("button").blur();
            document.execCommand("HiliteColor", false, "yellow");
            sel.collapseToEnd();
        }
        document.designMode = "off";
    } 
    else 
        if (document.body.createTextRange) {
            var textRange = document.body.createTextRange();
            while (textRange.findText(text)) {
                textRange.execCommand("BackColor", false, "yellow");
                textRange.collapse(false);
            }
        }
}
</code></pre>

<p>and fiddle is <a href="http://jsfiddle.net/xeSQb/6/" rel="nofollow">here</a>. I am not that much sound in knowledge to edit this script. How do I make work in Internet&nbsp;Explorer also...</p>
