<html><head>
<meta charset="utf-8"/>
<title>表单事件</title>
<script type="text/javascript">
function copyText() { let text1 = document.getElementById('text1').value; let text2 = document.getElementById('text2').innerHTML; document.getElementById('text2').innerHTML = text2 + text1;
} </script></head><body><form action="#">
<fieldset>
<legend>鼠标事件演示</legend>
<label>文本:</label><input type="text" id="text1" value=""/><br/>
<label>复制的文本:</label>
<output id="text2"></output>
<br/><br/>
<input type="button" value="单击复制文本" onclick="copyText()"/>
<input type="button" value="双击复制文本" ondblclick="copyText()"/>
<input type="button" value="鼠标按键复制文本" onmousedown="copyText()"/>
<input type="button" value="鼠标移开复制文本" onmouseout="copyText()"/>
<input type="reset" value="重置"/>
</fieldset></form></body></html>