首页
极刻
圈子
教程
开源
登录 / 注册
返回教程:Javascript 参考手册
TRY RUN / 在线示例
Javascript 参考手册 尝试一下
Javascript 参考手册 尝试一下
源代码
运行
<!DOCTYPE html> <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>
运行结果