1、 jQuery 的用法如下:
<!DOCTYPE html>
<html>
<head>
<style>
p { color:blue; }
div { color:red; }
</style>
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
</head>
<body>
<p>
Click and drag the mouse to select text in the inputs.
</p>
<input type="text" value="Some text" />
<input type="text" value="to test on" />
<div></div>
<script>
$("input").select( function () {
alert($(this).val());
});
</script>
</body>
</html>
2、javaScript 的用法如下:
<!DOCTYPE html>
<html>
<head>
</head>
<script>
function myOnSelect(c)
{
alert(c.value);
}
</script>
<body>
<p>
Click and drag the mouse to select text in the inputs.
</p>
<input type="text" value="Some text" οnselect="myOnSelect(this);"/>
<input type="text" value="to test on" οnselect="myOnSelect(this);"/>
</body>
</html>