Current location: Hot Scripts Forums » General Web Coding » JavaScript » Change background on select text input

Change background on select text input

Reply
  #1 (permalink)  
Old 06-16-09, 09:53 AM
pms pms is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Change background on select text input

Does anyone know how to change the background image of an Input text field on the momet it is selected? (someone starts entering text)

The background image is created using css:
INPUT_HOME { background-image: url(aardappelsalade.jpg); }

Any help would be appreciated!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-16-09, 10:45 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 7,508
Thanks: 3
Thanked 11 Times in 11 Posts
HTML Code:
<input
    onfocus = "this.style.background = 'url(aardappelsalade.jpg)';"
    onblur  = "this.style.background = '';"
    type    = "text"
/>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 06-17-09, 08:56 AM
jonnekke jonnekke is offline
Junior Code Guru
 
Join Date: Oct 2005
Location: holland!
Posts: 631
Thanks: 0
Thanked 0 Times in 0 Posts
is this cross-browser?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 06-17-09, 09:08 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 7,508
Thanks: 3
Thanked 11 Times in 11 Posts
Yeah, this should work on all browsers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 06-17-09, 12:28 PM
pms pms is offline
New Member
 
Join Date: Jun 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks!

Thank you Nico! This does the job!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Using an animated bg image in css for text input. It works but... AshleyQuick CSS 4 03-30-09 02:55 PM
Search script improvement 9999 PHP 14 08-29-06 12:46 AM
how to change text dynamically with image? rabbit51 JavaScript 1 02-23-04 09:35 AM
picking random entries with a filter... Double selection problem dsumpter PHP 7 11-16-03 08:19 PM
How to enabled or disabled input text using a checkbox Han84 HTML/XHTML/XML 1 10-13-03 09:46 AM


All times are GMT -5. The time now is 01:50 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.