javascript改变字体颜色实例

我写的一个改变字体颜色的实例:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>字体颜色改变实例</title>
<style type="text/css">
<!--
.style1 {color: #FF0000}
.style2 {color: #0000FF}
-->
</style>
</head>
<body>
<script language="javascript">
function gai()
{
if(test.style.color!=\'red\')
test.style.color=\'red\';
else
test.style.color=\'green\';
}
</script>
<p id="test">高增分</p>
<input type="button" value="提交" onClick="gai()">
</body>
</html>

原文地址:https://www.cnblogs.com/sutengcn/p/278495.html