複製代碼代碼如下:
<html>
<head>
<title>響應滑鼠自動選取文字方塊內容</title>
</head>
<body>
<input id="a" type="text" value="請輸入搜尋字" onmouseover="selectInputContent(this.id)"/>
<script type="text/javascript">
function selectInputContent(n){
obj =document.getElementById(n);
obj.focus();
obj.select();
}
</script>
</body>
</html>