首页 > 代码库 > 用js实现左右阴影的切换

用js实现左右阴影的切换

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style type="text/css">
p{
text-align:center;
font:bold 60px Verdana, Geneva, sans-serif;
text-shadow:1em 1em 1em red;}
</style>
</head>

<body>
<p id="bt">HTML5+CSS3</p>
<input type="button" onClick="change(‘1em 1em 1em red‘)" value="http://www.mamicode.com/右下角"/>
<input type="button" onClick="change(‘-1em 1em 1em yellow‘)" value="http://www.mamicode.com/左下角"/>
<script type="text/javascript">
function change(bt){
document.getElementById("bt").style.textShadow=bt;}
</script>
</body>
</html>

用js实现左右阴影的切换