Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Select All Text In A Form Field On Click
Amezis
post Oct 3 2005, 10:51 AM
Post #1


Privileged Member
*********

Group: Members
Posts: 535
Joined: 14-February 05
From: Oslo, Norway
Member No.: 3,759



Hi, I have made a script which generates a BBcode when you run it, and displays it in a text field, like this:
CODE
<input type="text" name="bbcode" size="81" value="[IMG]<?php echo $url; ?>[/IMG]">

Well, anyway, I want something that selects all the text in that form field when you click on it, like it does in ImageShack when you upload...
Go to the top of the page
 
+Quote Post
Avalon
post Oct 3 2005, 12:26 PM
Post #2


Privileged Member
*********

Group: Members
Posts: 630
Joined: 12-August 05
From: Melbourne, Australia
Member No.: 10,624



Looking at the Imageshack site, this is the way you could do it for your site.

Set up a function in between the <head> </head> tags of your page like this.
CODE
<script language="JavaScript">
function highlight(field) {
       field.focus();
       field.select();
}</script>


And then for each field that you want to select all the text in when clicked, add this 'onClick' action.

CODE
<input type="text" name="bbcode" size="81" value="[IMG]<?php echo $url; ?>[/IMG]" onClick='highlight(this);'>


Hope that helps. smile.gif
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Layers With Text Appear(1)
  2. Add Text In Input-field(5)
  3. Glow Text(2)
  4. Word Wrap Text In Div.(16)
  5. Text Problem(6)
  6. Simulate Click In Ie(4)
  7. Centered Div Layout Issues(2)
  8. Any Advice From Experts?(3)


 



- Lo-Fi Version Time is now: 11th October 2008 - 11:54 PM