欢迎访问:常州市武进区嘉泽中心小学网站 !今天是:
栏目列表
您现在的位置是:首页>>教师>>计算机技术>>网站制作技术>>文章内容
实时改变样式的例子
发布时间:2008-11-20   点击:   来源:本站原创   录入者:佚名
 

1、利用CSS来改变的例子
<head>
<script>
function StyleChange(StyleName)
{ChangeStyle.className=StyleName;}
</script>

<style>
<!--
.style1  { FONT-FAMILY: Georgia; }
.style2  { FONT-FAMILY: 宋体; }
-->
</style>

</head>

<span onclick=StyleChange("style1") style="cursor:hand">样式1</span>
<span onclick=StyleChange("style2") style="cursor:hand">样式2</span>

<table>
<tr>
<td id=ChangeStyle>
1981年11月19日
</td>
</tr>
</table>

2、又一个实时改变样式的例子:
<script language=javascript>
function FontChange(fontsize)
{
 document.getElementById('fontchange').style.fontSize=fontsize+'px'
}
</script>

<a href="javascript:FontChange(48)">click here</a>

<span id="FontChange">1981年11月19日</span>


附件:
    关闭窗口
    打印文档
    账号登录
    保持登录 忘记密码?
    账号与武进教师培训平台同步