Solved

textbox cleared

Posted on 2004-09-10
7
260 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 50

Expert Comment

by:Ryan Chong
ID: 12033208
or simplified to:

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

0
 
LVL 50

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iOS retina Display, HTML Email Signature 5 514
RSS Feeds--IE 13 179
How to i line up css containers from left to right 35 23
PHP email variable syntax 3 52
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

832 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