编辑下面的代码:【加编码】
<html> <head> <script> function displayResult() { document.getElementById("p1").style.minWidth="200px"; } </script> </head> <body> <p style="background:red;width:100px;" id="p1">This paragraph has a width of 100px.<br> When clicking on the button below,<br> the min-width will be set to 200px.<br> As a result, this paragraph should be 200 pixels wide.</p> <input type="button" onclick="displayResult()" value="Set min width"> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂