W3School TIY
编辑您的代码:
<html> <head> <script type="text/javascript"> function setFont() { document.getElementById("p1").style.font="italic bold 12px arial,serif"; } </script> </head> <body> <p id="p1">This is an example paragraph.</p> <input type="button" onclick="setFont()" value="Change font" /> </body> </html>
查看结果: