Return to Snippet

Revision: 29403
at July 28, 2010 19:45 by chemical


Initial Code
<!------>
 
<script type="text/javascript">
 
    function select_field(id){
 
        document.getElementById(id).focus();
        document.getElementById(id).select();
 
    }
 
    function init(){
        select_field('text1');
    }
 
    onload=init;
 
</script>
 
<form>
 
This field gets selected onload:<br/>
<input type="text" name="text1" id="text1" value="some text" />
 
<br/>
 
<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>

Initial URL

                                

Initial Description

                                

Initial Title
Select text in forms

Initial Tags

                                

Initial Language
HTML