Debt Consolidation - Debt Consolidation - Chants - Lockers - Infrared Sauna

PDA

View Full Version : Selecting all texts in text area on a single click?


vbwiz
Dec 4th 2006, 4:17 pm
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">
<!-- !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->


Where do I put the function?

vbwiz
Dec 4th 2006, 4:26 pm
I figured it out, add onFocus="this.select()"

vbwiz
Dec 4th 2006, 4:29 pm
Nope, where do I put the function?

venom
Dec 4th 2006, 6:10 pm
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();
}


Then you should be able to use onClick="select_all();" in your textarea.

klown
Dec 4th 2006, 6:13 pm
here an example


<input title="enter your email here" type=text name=email value="email@address.com" onclick=this.select();>