textbox cleared

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
sandeep437Asked:
Who is Participating?
 
Neil_SimpsonConnect With a Mentor Commented:
use javascript such as

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

this.value=''; should also work I think.
0
 
Ryan ChongCommented:
or simplified to:

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

0
 
Ryan ChongCommented:
nah... didn't see Neil's 2nd comment, disregard my comment above, cheers
0
 
StormyWatersCommented:
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
 
VincentPugliaCommented:
Another possibility:

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

Vinny
0
All Courses

From novice to tech pro — start learning today.