用js实现左右阴影的切换

时间:2021-10-28 00:31:37

<!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="右下角"/>
<input type="button" onClick="change('-1em 1em 1em yellow')" value="左下角"/>
<script type="text/javascript">
function change(bt){
document.getElementById("bt").style.textShadow=bt;}
</script>
</body>
</html>