Select All Text In A Form Field On Click

free web hosting
Open Discussion > CONTRIBUTE > Computers > Programming Languages > HTML, XML etc..

Select All Text In A Form Field On Click

Amezis
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...

Reply

Avalon
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

Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.

Recent Queries:-
  1. selectall textfield flex - 22.13 hr back. (1)
  2. onclick in text_field in rails - 84.16 hr back. (1)
  3. flex selectall - 119.48 hr back. (1)
  4. select all text in input field - 567.87 hr back. (1)
  5. browser click "select all text" - 1012.91 hr back. (1)
Similar Topics

Keywords : text click

  1. Word Wrap Text In Div. - (16)
    i use 2 div's for the page layout. One for navigation and one for the contents. html Code:
    Original - html Code: CODE    <div width="10%" style="position:
    absolute; left: 2%;">
    bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb </div> <div
    width="86%" style="position: absolute; left: 14%;"> bbbb </div>
    But now the b's wont stay within their div-element. I want lines that doesnt fit on one line
    within the divto wrap to the next line. How can i do this?...
  2. Any Advice From Experts? - wrapping text around pictures. (3)
  3. Centered Div Layout Issues - Float Right item not vertically aligned with text (2)
    Hey everyone. I am writing an all div layout for my friends website and i just cant seem to get all
    the fields aligned properly. I can get all my images to be aligned and look great until i put any
    text on the site. For example, my box that will contain links and such has 3 parts: top, middle and
    bottom. Each of these have 3 parts: left, middle and right. To program the 3 parts of each row, i
    use 3 divs which are all floated based on their position. However, as soon as I put text in the
    middle area, the right image is moved down to a new line. The sample site is located ...
  4. Simulate Click In Ie - (4)
    Does anyone know how can i "emulate" a click on a link in Internet Explorer. I want it to be closest
    to a user-like click posible. I know that IE knows if one real user clicks the link or it's just
    a script that does that. Is it posible to "fool" IE with a script (HTML, Java, PHP, Actionscript,
    etc) ? Or maybe, can you tell me how does IE knows that it's not a real user behind the click? ...
  5. Text Problem - (6)
    Alright well I am having a slight problem with my coding. I made my template and have it up on my
    site but my text I placed in the content box is towards the middle. I would like it at the top but
    I forget how to do that. I know it has to do with some like putting a table inside the table and
    making the height 100% or something. If someone could help me out with the coding I would greatly
    appreciate it. The link to my site is Here and the code used for the content box is this...
    CODE   <td colspan="6" rowspan="3"background="images/cont...
  6. Glow Text - need help (2)
    Hi i Have One Vbulletin Form and i want Glow Users Name in form How can i do this I search in
    JavaScripts but i can not find it If You find it tell me thanks then Where Past this code on my form
    thanks /blink.gif' border='0' style='vertical-align:middle' alt='blink.gif' /> ...
  7. Add Text In Input-field - (5)
    this is a picture of my shoutbox: one problem: the links/code for adding one of the smilies to
    the message-input-field (text: e.g. /laugh.gif' border='0' style='vertical-align:middle'
    alt='laugh.gif' /> , /unsure.gif' border='0' style='vertical-align:middle' alt='unsure.gif' />
    ,...) are missing. Does someone knows how this can be fixed? -the name of the message-input-field
    is "message". thanks in advance! /cool.gif' border='0' style='vertical-align:middle'
    alt='cool.gif' /> ...
  8. Layers With Text Appear - (1)
    When I view this page in a Firefox browser on a Windows operating system, it looks fine, but when I
    view it on a friend's Firefox browser on his Linux operating system, the text layers extend
    their height downward on the page and overlaps the graphics on the bottom of the page. Is there a
    known fix?...
  9. Deactivate right click - in internet explorer (42)
    CODE <style onload="function noRightClick() {if(event.button==2)
    {alert('CopyrightŪ by Bullit')}}document.onmousedown=noRightClick">
    </style> OR CODE <noscript>You need to have JavaScript enabled in order to
    view this page correctly!</noscript> <script
    type="text/javascript"><!-- var message="don't do that"; function
    clickIE4(){ if (event.button==2){ alert(message); return false; } }
    function clickNS4(e){ ...
  10. Can you disable the left click? - (20)
    Just for a bit of fun, I know its possible to disable the right click, but is it posible to disable
    the left click??? Laterz Matty...



Looking for select, text, form, field, click

*RANDOM STUFF*





*SIMILAR VIDEOS*
Searching Video's for select, text, form, field, click

*MORE FROM TRAP17.COM*
advertisement



Select All Text In A Form Field On Click



 

 

 

 

ADD REPLY / Got an Opinion! a humble request :-) RAPID SEARCH! Free Hosting [X]
Express your Opinions, Thoughts or Contribute your information that might help someone here.
Ask your Doubts & Queries to get answers.. "Together, We enlight each other!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE