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