|
Rank: Newbie Groups: Member
Joined: 4/25/2008 Posts: 3
|
Hi,
How to change the background color or the border color of the datepicker textbox when it get the focus (how to fire onfocus event ?) ?
Thanks
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You can use the following code to do so:
Code: JavaScript
function textbox_focus_handler(e)
{
//Call the original handler
this.oldOnFocus(e);
//Change background color
this.style.backgroundColor = "green";
}
function textbox_blur_handler(e)
{
//Call the original handler
this.oldOnBlur(e);
//Change background color
this.style.background = "white";
}
function init()
{
var textbox = document.getElementById("_eo_DatePicker1_picker");
//Save old onfocus and onblur handler
textbox.oldOnFocus = textbox.onfocus;
textbox.oldOnBlur = textbox.onblur;
//Hook up our new handlers
textbox.onfocus = textbox_focus_handler;
textbox.onblur = textbox_blur_handler;
}
Code: HTML/ASPX
<eo:DatePicker ClientSideOnLoad="init" ....>
</eo:DatePicker>
Note you will need to replace "DatePicker1" with the actual ID of your DatePicker control for the document.getElementById call. If you are not sure what it is, you can view the page's HTML source and find out. Thanks
|
|
Rank: Newbie Groups: Member
Joined: 4/25/2008 Posts: 3
|
Thanks a lot, It works fine !
|
|
Rank: Newbie Groups: Member
Joined: 9/3/2008 Posts: 5
|
the following code is not working correctly, its calling init() but its not calling textbox_blur_handler(e) when the browser is refresh some is working and some time is not working.
i am using client side monitor code also for the same page
is there any other alternative way, at server side it self do this things
|
|