View Single Post
Old 02-09-2005, 05:06 AM  
AlCapone
Confirmed User
 
AlCapone's Avatar
 
Join Date: Sep 2003
Posts: 708
FIX the Google Problem!!!! (script)

Some of you may have noticed that when coloring your pages & sites with stylesheets, you end up with some of the text inputs on your forms a weird yellow color, for areas that have "auto-fill" content contained within them. The Google Toolbar causes this annoyance. This can be obnoxious if you have a light colored text for your form fields., so here's the fix.

Step 1: Copy the following code and paste it into notepad -
PHP Code:
  if(window.attachEvent)
    
window.attachEvent("onload",setListeners);
  
  function 
setListeners(){
    
inputList document.getElementsByTagName("INPUT");
    for(
i=0;i<inputList.length;i++)
      
inputList[i].attachEvent("onpropertychange",restoreStyles);
    
selectList document.getElementsByTagName("SELECT");
    for(
i=0;i<selectList.length;i++)
      
selectList[i].attachEvent("onpropertychange",restoreStyles);
  }

  function 
restoreStyles(){
    if(
event.srcElement.style.backgroundColor != "" && event.srcElement.style.backgroundColor != "#a0d0ff"){
      
event.srcElement.style.backgroundColor "#a0d0ff"/* color of choice for AutoFill */
      
document.all['googleblurb'].style.display "block";
    }
  } 
Step 2: Save this file as "googlefix.js" or whatever you like.

Step 3: Paste the following code into the [head] of each of your documents where form elements are -
PHP Code:
<script type="text/javascript" src="googlefix.js"></script> 
That's it!

Enjoy!
__________________
"You can get more with a kind word and a gun than you can with a kind word alone.”

Last edited by AlCapone; 02-09-2005 at 05:07 AM..
AlCapone is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote