Solved

textbox cleared

Posted on 2004-09-10
7
247 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 49

Expert Comment

by:Ryan Chong
ID: 12033208
or simplified to:

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

0
 
LVL 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now