Solved

textbox cleared

Posted on 2004-09-10
7
261 Views
Last Modified: 2010-04-06
hi

i have a textbox on form and by default "0" is displayed in the textbox.

wht i want is when the user clicks in the textbox "0" must be automatically cleared so that he doesnt have to delete it
manually.

thanks

sandy
0
Comment
Question by:sandeep437
7 Comments
 
LVL 4

Accepted Solution

by:
Neil_Simpson earned 125 total points
ID: 12031918
use javascript such as

onFocus=document.getElementById('textboxID').value = '';"

this.value=''; should also work I think.
0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 12033208
or simplified to:

<input name="textfield" type="text" value="0" onFocus="this.value=''">

0
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 12033214
nah... didn't see Neil's 2nd comment, disregard my comment above, cheers
0
 
LVL 13

Expert Comment

by:StormyWaters
ID: 12034315
It might be nicer on the user to have:

<input name="textfield" type="text" value="0" onFocus="this.value = (this.value=='0'?'':this.value)">
0
 
LVL 15

Expert Comment

by:VincentPuglia
ID: 12038671
Another possibility:

<form>
<input type='text' value='0' onFocus='this.select()'>
</form>

Vinny
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to analyze web traffic logs 10 111
Magento Indexing 1 103
Grunt Copy file to another destination. 1 58
removing a class in javascript 4 51
Preface In the first article: A Better Website Login System (http://www.experts-exchange.com/A_2902.html) I introduced the EE Collaborative Login System and its intended purpose. In this article I will discuss some of the design consideratio…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL (http://www.experts-exchange.com/articles/201/Handling-Date-and-Time-in-PHP-and-MySQL.html) several years ago, it seemed like now was a good time to updat…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to count occurrences of each item in an array.

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question