How do I do this without the function in the <head> section as showed on this page? http://www.plus2net.com/javascript_tutorial/textarea-onclick.php I can't use what that tutorial has because I'm using smarty templates and in the head section of my header there's the following. <!--!!!!!!!!!!!!!!!!!!!!!!!! LIBRARY !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!--> <script src="{$baseurl}/ajax/cpaint2.inc.js" type="text/javascript"></script> <script src="{$baseurl}/js/myjavascriptfx.js" type="text/javascript"></script> <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> <!--!!!!!!!!!!!!!!!!!!!!!!!!! Processing SCRIPT !!!!!!!!!!!!!!!!!!!--> <script language=JavaScript src={$baseurl}/js/indexonly.js></script> <script language=JavaScript src={$baseurl}/js/myjavascriptajax.js></script> <script language=JavaScript src={$baseurl}/js/myjavascript.js></script> <link href="{$baseurl}/css/style.css" rel="stylesheet" type="text/css"> <!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> PHP: Where do I put the function?
You could just copy the function into one of the existing javascripts that is in your header template. Just copy this code in there function select_all() { var text_val=eval("document.form1.type"); text_val.focus(); text_val.select(); } Code (markup): Then you should be able to use onClick="select_all();" in your textarea.
here an example <input title="enter your email here" type=text name=email value="email@address.com" onclick=this.select();> Code (markup):