font 属性在一个声明中设置所有字体属性。
</>code
- Object.style.font=value
值 | 描述 |
---|---|
|
设置字体的属性。 |
caption | 为控件定义字体(比如按钮、下拉列表等)。 |
icon | 定义用于标注图标的字体。 |
menu | 定义菜单中使用的字体。 |
message-box | 定义对话框中使用的字体。 |
small-caption | 定义用于标注小型控件的字体。 |
status-bar | 定义在窗口状态栏中使用的字体。 |
本例改变文本的字体:
</>code
- <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 paragraph style" />
- </body>
- </html>
如对本文有疑问,请提交到交流论坛,广大热心网友会为你解答!! 点击进入论坛
Powered by 365建站网 RSS地图 HTML地图
copyright © 2013-2024 版权所有 鄂ICP备17013400号