Onfocus/onblur background image?

I’m doing this for an input box:
onfocus=“this.style.background=‘#e7e7e7’”
but onblur I want to make it go back to the background image it was at. How do I do that?

Were you looking for something different than this?

Tested on FF and IE and works fine.


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>		 
 <style type="text/css">
 <!-- 
  input {
 background: url(F04.jpg);
  }
 -->
 </style>
 <title>test</title>
 </head>
 <body>
 <form action="test.html">
 <input type="text" onfocus="this.style.background='#e7e7e7'" onblur="this.style.background='url(F04.jpg)'" />
 </form>
 </body>
 </html>
 
 

Ah, that’s what I was looking for. Thanks, I’m not real familiar with javascript syntax.

I’m glad it helped.

Regards