W3School TIY
脚 本 学 堂 www.jbxue.com
编辑您的代码:
<html> <head> <script type="text/javascript"> function setFont() { document.getElementById("p1").style.fontFamily="arial,sans-serif"; } </script> </head> <body> <p id="p1">This is an example paragraph.</p> <input type="button" onclick="setFont()" value="Change font" /> </body> </html>
查看结果: