View Single Post
08-21-2007, 08:18 PM
#1
Daniel591992 is offline Daniel591992
Status: Member
Join date: Jul 2006
Location:
Expertise:
Software:
 
Posts: 161
iTrader: 0 / 0%
 

Daniel591992 is on a distinguished road

Send a message via AIM to Daniel591992 Send a message via MSN to Daniel591992

  Old  How to add Google Search to a PHProxy Theme :)

I was working on coding my second PHProxy theme a few days ago and wanted to add Google Search functionality to it. I had that planned since I started the design. I'm not great at Javascript, so I had no clue how to do it. A friend helped me do it, and I'd like to share.

What it Does
It adds Google Search functionality to a proxy site. You don't need to enter www.google.com in the textbox to go to Google, and then search. Instead, you can enter a search query in the same textbox and click on Google search. This is something I've never seen before on proxies.

Preview
Go here and click on test.

How to do it
Add this between your head tags:
Code:
<script language="JavaScript" type="text/javascript">
function submitForm()
{
document.FORM_NAME.submit();
}
</script>
<script language="JavaScript" type="text/javascript">
function google(){
text = document.FORM_NAME.TEXT_FIELD_NAME.value;
document.a.q.value = "http://google.com/search?q=" + text;
}
</script>
I know the coding isn't great, but what it does it when someone clicks on the Google Search button on your page, the second script will write the search url, and the first script will submit it.

On the Google Search button, you need this:
Code:
onclick="google(),submitForm()"


That's it



I'd appreciate it if you link to my site, share it, or just subscribe to my RSS feed for other free designs.