javascript in textbox..

Posted by Gopal_nivas under JavaScript on 7/1/2010 | Views : 2068 | Status : [Member] | Replies : 3
hi i want to enter dd/mm/yyyy in 3 textboxes.

by default
in textbox1.text=dd
textbox2.text=mm
textbox3.text=yyyy

if the pointer moves to textbox1 (i.e focus) then the text "dd" should be cleared if i my pointer moves to next textbox2 means the value "dd" should be again come to textbox1..

simultaneously for textbox2 and 3..

how to do this..

i need script for this logic..


need ur suggestions

regards
gopal.s




Responses

Posted by: Easwaran on: 7/1/2010 [Member] Starter

Up
0
Down
Hi,

Please try with Textbox's Onfocus(Implement logic to hide dd) and Onblur(Implement logic to show dd) events.

I hope this helps.

I'm not sure why do you want to display dd again in Textbox1 after setting focus somewhere else.

Regards,
Easwaran.

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Muhilan on: 7/2/2010 [Member] Starter

Up
0
Down
<asp:textbox onfocus="javascript:enter(this)" onblur="javascript:exit(this)"></asp:textbox>

function enter(txt)
{
txt.value="";
}

function exit(txt)
{
if(txt.value <> "")
{
txt.value="dd"
}
}

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 7/2/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Hi Guys, when you post your code please donot forget to put it inside the Code tags provided on the Toolbar

Thanks

Thank you for posting at Dotnetfunda
[Administrator]

Gopal_nivas, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response