编辑下面的代码:【加编码】
<html> <body> <pre id="t1"> I have tabs inside! </pre> <p>点击“尝试一下”按钮,改变 PRE 元素的 tab-size 属性。</p> <button onclick="myFunction()">尝试一下</button> <script> function myFunction() { document.getElementById("t1").style.tabSize = "16"; document.getElementById("t1").style.MozTabSize = "16"; // 针对 Firefox 的代码 document.getElementById("t1").style.OTabSize = "16"; // 针对 Opera 的代码 } </script> <p><b>Note:</b> The tabSize property is currently only supported in Chrome.</p> <p><b>Note:</b> Firefox supports an alternative, the MozTabSize property.</p> <p><b>Note:</b> Opera supports an alternative, the OTabSize property.</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂