Microsoft KB Archive/838467

= BUG: Elements in a Web page shift position when you format selected text =

Article ID: 838467

Article Last Modified on 5/17/2007

-

APPLIES TO


 * Microsoft Internet Explorer (Programming)

-



SYMPTOMS
When you select text in a Web page, and then run the execCommand method with Italic as the parameter, you may notice that the elements in the Web page shift position.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section of this article.



Steps to reproduce the behavior
 Create an HTML file. To do this, follow these steps:  Click Start, and then click Run. The Run dialog box appears. Type notepad in the Open box, and then click OK to start Notepad.  Paste the following code in Notepad:    function change {           var oSel = document.selection; var oTxt = oSel.createRange; oTxt.execCommand(&quot;Italic&quot;); oTxt = null; oSel = null; }                <BODY> <BUTTON onclick=change;>Italics</BUTTON> <SPAN contentEditable=false>some data</SPAN> <SPAN contentEditable=false>some data</SPAN> <INPUT id=Text1 contentEditable=false name=Text1> <SPAN contentEditable=false>some data</SPAN> <INPUT id=Text2 contentEditable=false name=Text2> <SPAN contentEditable=false>some data</SPAN><BR> <SPAN contentEditable=false>some data</SPAN><BR><BR> <INPUT id=Text3 contentEditable=false name=Text3> <BR><BR><BR> <SPAN contentEditable=false>some data</SPAN> <BR> <SPAN contentEditable=false>some data</SPAN> <BR> </BODY> </HTML> </li> On the File menu, click Save. The Save As dialog box appears.</li> In the File name box, type the name of the file as Sample.html .</li> In the Save as type list, click All Files, and then click Save.</li></ol> </li> Open the Sample.html file that you saved in step 1. e in Microsoft Internet Explorer.</li> Select any text on the Web page, and then click Italics. You may notice the behavior that is described in the &quot;Symptoms&quot; section.</li></ol>

<div class="references_section">