javascript textbox changer

This is a discussion on "javascript textbox changer" within the JavaScript Forum section. This forum, and the thread "javascript textbox changer are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Aug 13th, 2004, 04:49
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
javascript textbox changer

I have a form...
which consist of two text field that will be entered by the user!

What i want to do is, there will be a button or a text link beside each of the text box(similar to javascript date picker) but when the user click the link, what ever inside the text box will be replace with "EMPTY" word, this "EMPTY" word is fixed!

can anybody help me!
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!

  #2  
Old Aug 13th, 2004, 07:48
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
add an id="text1" and id="text2" to each text field, and then for the button or text link put the following code:

Code: Select all
document.getElementById('text1').value = "EMPTY";
where text1 is the id of the text boxes

hope that helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #3  
Old Aug 16th, 2004, 04:14
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
well, i get the idea, but i dont know how to make the link text?
this is my from:
How do i make the link
Where should i put the "document.getElementById('text1').value = "EMPTY";"


can you show me, please

<form name="form1">



<input id="text1" type="text" name="age">change</p> <--This will be the text button-->
</p>
</form>
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #4  
Old Aug 16th, 2004, 06:47
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
like this monie

Code: Select all
<form name="form1">



<input id="text1" type="text" name="age">change</p> Text Link
</p>
</form>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #5  
Old Aug 17th, 2004, 02:50
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
thanx benbacardi
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #6  
Old Aug 18th, 2004, 01:38
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
hey...another thought!
What if i have multiple field that i want to change the value inside the text box with just one text link?

i tried to modify your code but doesn't seems to work!
is it posible to do that?
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #7  
Old Aug 18th, 2004, 07:16
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
what do you mean a multiple field?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #8  
Old Aug 19th, 2004, 01:40
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,612
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Sorry about that...
I have more that one text box (text input)in my page,
when i clicked the text link(that you gave me)...
all of the value inside the text box will be changed to "EMPTY"
that means, with just one text link,
it will change all the text input to "EMPTY"
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #9  
Old Aug 19th, 2004, 06:46
benbacardi's Avatar
Highly Reputable Member
Join Date: Feb 2004
Location: United Kingdom
Age: 20
Posts: 611
Thanks: 0
Thanked 0 Times in 0 Posts
just add more id's to the text boxes, and then add more corresponding

Code: Select all
document.getElementById('text1').value="EMPTY";
to the onclick event of the link.

Make sure you have the semi-colon at the end of each "EMPTY"; - otherwise it wont work!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
javascript, textbox, changer

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
textbox in datalist ktsirig ASP.NET Forum 0 Dec 14th, 2007 15:40
Problem to add text to the textbox flexed JavaScript Forum 1 Aug 21st, 2006 06:43
TextBox problem accessman Databases 1 Oct 15th, 2005 01:19
Error Message: TextBox accessman Databases 1 Oct 15th, 2005 01:07
VS.NET, TextBox, overlay, DataGrid Smokie ASP.NET Forum 10 Jul 27th, 2004 12:17


All times are GMT. The time now is 20:24.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved