Current location: Hot Scripts Forums » General Web Coding » JavaScript » auto select all text within an input value ?


auto select all text within an input value ?

Reply
  #1 (permalink)  
Old 01-05-08, 07:01 AM
triplebig triplebig is offline
Newbie Coder
 
Join Date: Nov 2007
Posts: 83
Thanks: 6
Thanked 0 Times in 0 Posts
Question auto select all text within an input value ?

Code:
<input name="permalink" value="<{$site}>/single.php?id=<{$id}>" readonly="readonly" style="width: 200px; margin-top: 2px;" type="text">
i want user click the input and automatically it will select all the value
Reply With Quote
  #2 (permalink)  
Old 01-05-08, 01:05 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Here's one way:


Code:
<form>
<textarea name="theText" rows=4 cols=40>
Here's the text that you want highlighted.
</textarea>


<input type="button" value="Highlight Text" 
onClick="javascript:this.form.theText.focus();this.form.theText.select();">
</form>
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #3 (permalink)  
Old 01-05-08, 09:02 PM
triplebig triplebig is offline
Newbie Coder
 
Join Date: Nov 2007
Posts: 83
Thanks: 6
Thanked 0 Times in 0 Posts
thank you end user

is there another way ?

i would like it to be in youtube video page embed value
Reply With Quote
  #4 (permalink)  
Old 01-06-08, 11:48 AM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by triplebig View Post
is there another way ?

i would like it to be in youtube video page embed value
I'm not sure I understand your question. Are you saying you want to select the 'embed code' text on the Youtube page?
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #5 (permalink)  
Old 01-06-08, 01:47 PM
triplebig triplebig is offline
Newbie Coder
 
Join Date: Nov 2007
Posts: 83
Thanks: 6
Thanked 0 Times in 0 Posts
sorry for my poor english


what i mean was in the youtube website when you watch a video there in an input value for the embed code that when onclick the input field it will auto select all the embed code


i want a function just like that in my site

auto select all text within an input value automatically

Last edited by triplebig; 01-06-08 at 01:50 PM.
Reply With Quote
  #6 (permalink)  
Old 01-06-08, 04:01 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Quote:
Originally Posted by triplebig View Post
i want a function just like that in my site
auto select all text within an input value automatically
That's what that code does. Did you try it?
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
  #7 (permalink)  
Old 01-06-08, 08:18 PM
triplebig triplebig is offline
Newbie Coder
 
Join Date: Nov 2007
Posts: 83
Thanks: 6
Thanked 0 Times in 0 Posts
yes..currently using it in my site

but i prefer using just input value than a text area with input button
Reply With Quote
  #8 (permalink)  
Old 01-06-08, 08:35 PM
End User's Avatar
End User End User is offline
Level II Curmudgeon
 
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
Code:
<form>
<input type="text" name="theText" size="20" onClick="javascript:this.form.theText.focus();this.form.theText.select();">
</form>
__________________
I don't live on the edge, but sometimes I go there to visit.
-------------------------------------------------------------------------
Sanitize Your Data | Oracle Date & Substring Functions | Code Snippet Library | [url=http://www.codmb.com/Call Of Duty[/url]
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
text box with scroll bar silvermane CSS 7 01-16-09 03:03 AM
Search script improvement 9999 PHP 14 08-28-06 11:46 PM
Draggable Tables Ares JavaScript 10 08-03-06 06:55 AM
Need Your HelP! Loading Multiple External Text into Multiple Dynamic Text Fields Flash_Boi Flash & ActionScript 2 03-30-06 03:27 PM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 07:19 PM


All times are GMT -5. The time now is 11:33 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.