案例:html/html5 案例     状态:可编辑再运行    进入竖版
 运行结果 
x
 
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script>
5
function showMsg()
6
{
7
alert("您选中了一些文本!");
8
}
9
</script>
10
</head>
11
<body>
12
13
一些文本:<input type="text" value="请选中我!" onselect="showMsg()">
14
15
<p>函数 showMsg() 在输入字段中的文本被选中时触发。此函数显示一段消息。</p>
16
17
</body>
18
</html>
19