案例:javascript案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<html>
2
<head>
3
<script type="text/javascript">
4
function setTextAlign()
5
{
6
document.getElementById("p1").style.textAlign="right";
7
}
8
</script>
9
</head>
10
<body>
11
12
<p id="p1">This is an example paragraph.</p>
13
14
<input type="button" onclick="setTextAlign()" value="Align text" />
15
16
</body>
17
</html>
18