选择文字
显示如何在textarea中选择文本
<!------>
<script type="text/javascript">
function select_field(id){
document.getElementById(id).focus();
document.getElementById(id).select();
}
function init(){
select_field('text1');
}
onl oad=init;
</script>
<form>
This field gets selected onl oad:<br/>
<input type="text" name="text1" id="text1" value="some text" />
<br/>
<!-- 512-笔记网 jb51.cc -->
<textarea name="textarea1" id="textarea1" rows="9" cols="50" wrap="off">Some long
content in here.
abcd efgh abcd efgh abcd efgh
abcd efgh abcd efgh abcd efgh
abcd efgh abcd efgh abcd efgh
</textarea>
<br/>
<input type="button" value="Select text" onclick="select_field('textarea1')">
</form>
原文链接:https://www.f2er.com/html/527505.html