Use JavaScript Function on blur() and on focus() in ASP.NET

Step 1

Just drag one simple textbox from toolbox and just add attributes like the below screen shot.

Step 2

Then as we know, just write the required functions inside the Script tag like below:



That's it, now this function will be triggered inthe  client side and you will get the Output like the below screen shot

Output 1

While Cursor is on the Bill no,



Note

Changed to the Yellow Color since we have provided the color as "Yellow" in the myFocusFuction() in the above JavaScript code.

Output 2

Once it came out of the Bill No.



Note

Back to the Normal Color since we didn't provide any color in the myBlurFuction() in the above JavaScript code.