Page 1 of 1
how to create onclick event?
Posted: Mon Aug 03, 2009 11:09 pm
by adsegzy
I want an onclick event such that, when my visitors click on any field on my form, the default value disappears.
adsegzy
Re: how to create onclick event?
Posted: Tue Aug 04, 2009 1:37 am
by JAB Creations
Code: Select all
<input onclick="alert('replace this alert with a function');" />
You could use addEventListener (and addEvent for IE) though I think you'll need to figure out the basics first.
Re: how to create onclick event?
Posted: Tue Aug 04, 2009 2:46 am
by VladSun
You'd better use the
onfocus event (Tab navigation

)
Re: how to create onclick event?
Posted: Thu Aug 06, 2009 9:31 pm
by JAB Creations
Agreed, I
love sites that utilize blur and focus events.

Re: how to create onclick event?
Posted: Mon Aug 10, 2009 3:27 am
by frao_0
w3c say not to use inline CSS and JavaScript, which is sometimes a pain in the ass. But it would give something like this if your element has, let's say, an id value of 'myID'
Code: Select all
onload=function()
{
document.getElementById('myId').onclick=function()
{
this.value=''
}
}