Search me again

After struggling with loads of javascript/DHTML I optimized the Search functionality on this blog. I wanted a couple of features:
  1. A nice Google button
  2. Not Googleing when there are no keywords to look for.
  3. Allowing the user to press Enter after typing some keywords.
 
My troubles:
  1. Very quickly I added a very nice button with a background image only to find out that on Windows XP machines that have the XP look (I always have the classic-look) this button didn’t show the image. After Googleing for an answer I found out that there are possible incompatibilities between HTML and XP look and I could turn the XP look temporarily off by setting an HTML META tag. Unfortunately I do not have access to the HTML HEAD of these pages so I had to come up with another approach. As you can see in the code below I added a fake border around an image…
  2. This was simply solved by adding an if to the code.
  3. This needed some extra effort but was doable.
 
My code:
 
<input type=”text” id=”googleQuery” onkeydown=”
  if (event.keyCode == 13)
  {
    event.returnValue=false;
    event.cancel = true;
    document.all.googleBlog.click();
  }
“/>
 
<input type=”image” id=”googleBlog” value style=”border-style: outset; border-width: 2px;background-color:#C0C0C0;” src=”http://www.google.com/intl/en/logos/Logo_25gry.gif
onclick=”
  if(document.all.googleQuery.value != ”)
  {
    window.open(‘http://www.google.com/search?q=site:https://accblogs.infosupport.com/ernow ‘ + escape(document.all.googleQuery.value))
  }
  else
  {
    event.returnValue=false;
    event.cancel = true;
  }
” />