...

View Full Version : Google custom search engine



DimisD
02-07-2007, 11:48 PM
Hi,
is there someone who can fix this custom google search engine for me please?
The problem is that i can not pass the href values to the Form action.

thank you.


<HTML>
<HEAD>
<TITLE>custom google search</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>

<style>
.tabInactive { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: underline}
.tabActive { FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
</style>

<SCRIPT language=javascript>
function toggleTab ( searchType, qcat, idName )
{
var tabs = document.getElementsByTagName('a');

for( var i=0; i<tabs.length; i++ )
{
var tabi = tabs[i];

if ( tabi.id == idName && tabi.className == "tabInactive" )
{ tabi.className="tabActive";}
else if ( tabi.id == idName && tabi.className=="tabActive" )
{ tabi.className="tabActive";}
else if ( tabi.className=="tabActive" )
{ tabi.className="tabInactive";}
}
}
</SCRIPT>
</HEAD>

<BODY >
<FORM name=f action="http://www.google.com/search" method="get" target="_blank">

<TABLE border=0 cellPadding=0 cellSpacing=0 bgcolor="#88a3a9">
<TBODY>
<TR>
<TD colSpan=2><DIV id=navTab>
<A class=tabActive id=sbtWeb onClick="toggleTab('Web','web','sbtWeb'); return false;" href="http://www.google.com/search">
<DIV style="DISPLAY: inline">Web</DIV></A>
<SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px">
</SPAN>|<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN>

<A class=tabInactive id=sbtImages onClick="toggleTab('Image', 'images','sbtImages'); return false;" href="http://images.google.com/images">
<DIV style="DISPLAY: inline">Images</DIV></A>
<SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN>|
<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN>

<A class=tabInactive id=sbtVideo onClick="toggleTab('Video', 'smd','sbtVideo'); return false;" href="http://video.google.com/videosearch">
<DIV style="DISPLAY: inline">Video</DIV> </A>
<SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px">
</SPAN>|<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN>

<A class=tabInactive id=sbtMaps onClick="toggleTab('Maps', 'map','sbtMaps'); return false;" href="http://maps.google.com/maps">
<div style="display: inline;">Maps</div></A>
<SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN>|
<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN>

<A class=tabInactive id=sbtBlogs onClick="toggleTab('Blogs', 'blg','sbtBlogs'); return false;" href="http://blogsearch.google.com/blogsearch">
<DIV style="DISPLAY: inline">Blogs</DIV>
</A><SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN></DIV></TD>
</TR>
<TR>
<TD><INPUT style="WIDTH: 351px" name=q>
</TD>
<TD vAlign=center>
<DIV id=msSearchSubmit>
<INPUT type=submit value="search" alt=Search>
</DIV>
</TD>
</TR>
<TR>
<TD colSpan=2>
</TD>
</TR>
</TBODY>
</TABLE>
</FORM>

</BODY>
</HTML>

neomaximus2k
02-08-2007, 12:29 AM
Not had chance to test the script but this should work


<HTML>
<HEAD>
<TITLE>custom google search</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<style>
.tabInactive { FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana; TEXT-DECORATION: underline}
.tabActive { FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana; TEXT-DECORATION: none}
</style>
<SCRIPT language=javascript>
function toggleTab ( searchType, qcat, idName ){
var tabs = document.getElementsByTagName('a');

for( var i=0; i<tabs.length; i++ ){
var tabi = tabs[i];
if ( tabi.id == idName && tabi.className == "tabInactive" ){ tabi.className="tabActive";}
else if ( tabi.id == idName && tabi.className=="tabActive" ){ tabi.className="tabActive";}
else if ( tabi.className=="tabActive" ){ tabi.className="tabInactive";}
}

if (searchTpye == "Web")document.forms[0].action = "http://www.google.com/search";
if (searchTpye == "Image")document.forms[0].action = "http://images.google.com/images";
if (searchTpye == "Video")document.forms[0].action = "http://video.google.com/videosearch";
if (searchTpye == "Maps")document.forms[0].action = "http://maps.google.com/maps";
if (searchTpye == "Blogs")document.forms[0].action = "http://blogsearch.google.com/blogsearch";
}
</SCRIPT>
</HEAD>
<BODY >
<FORM name=f action="http://www.google.com/search" method="get" target="_blank">
<TABLE border=0 cellPadding=0 cellSpacing=0 bgcolor="#88a3a9">
<TBODY>
<TR>
<TD colSpan=2><DIV id=navTab> <A class=tabActive id=sbtWeb onClick="toggleTab('Web','web','sbtWeb'); return false;" href="http://www.google.com/search">
<DIV style="DISPLAY: inline">Web</DIV>
</A> <SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"> </SPAN>|<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN> <A class=tabInactive id=sbtImages onClick="toggleTab('Image', 'images','sbtImages'); return false;" href="http://images.google.com/images">
<DIV style="DISPLAY: inline">Images</DIV>
</A> <SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN>| <SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN> <A class=tabInactive id=sbtVideo onClick="toggleTab('Video', 'smd','sbtVideo'); return false;" href="http://video.google.com/videosearch">
<DIV style="DISPLAY: inline">Video</DIV>
</A> <SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"> </SPAN>|<SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN> <A class=tabInactive id=sbtMaps onClick="toggleTab('Maps', 'map','sbtMaps'); return false;" href="http://maps.google.com/maps">
<div style="display: inline;">Maps</div>
</A> <SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN>| <SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN> <A class=tabInactive id=sbtBlogs onClick="toggleTab('Blogs', 'blg','sbtBlogs'); return false;" href="http://blogsearch.google.com/blogsearch">
<DIV style="DISPLAY: inline">Blogs</DIV>
</A><SPAN class=tabDivider><SPAN class=spacer style="WIDTH: 6px; HEIGHT: 1px"></SPAN></SPAN></DIV></TD>
</TR>
<TR>
<TD><INPUT style="WIDTH: 351px" name=q>
</TD>
<TD vAlign=center><DIV id=msSearchSubmit>
<INPUT type=submit value="search" alt=Search>
</DIV></TD>
</TR>
<TR>
<TD colSpan=2></TD>
</TR>
</TBODY>
</TABLE>
</FORM>
</BODY>
</HTML>


Also you really should validate your code to W3C Standards as this would have so many errors

DimisD
02-08-2007, 01:29 AM
Excellent solution "neomaximus2k"!!!:thumbsup:

Thank you so much.

It works great, you just have misstyped the word "searchType" --> "searchTpye".


I don't know how to do W3C validation. Do you know how?:confused:

Again thank you !!!!:)

neomaximus2k
02-08-2007, 12:33 PM
Thanks DimisD I did do it rushed so I prob did a few typo's got a habbit of that lol.

As for validating just visit the following URL

http://validator.w3.org/

that will tell you all the errors in your document and you should be able to understand how to fix them, if not let me know

DimisD
02-09-2007, 01:45 PM
Thank you neomaximus2k!!
I validated the webpage and now i think it's ok.

I have another problem if you can help:

My page has a charset=utf-8
I have a textfield that passes the input text, into a another site that has charset=iso-8859-7.
Can i change the input textfield charset in charset=iso-8859-7 ?:confused:


thank you

neomaximus2k
02-09-2007, 02:52 PM
what happens when u pass the content at the moment?

also you could urlencode the value's and decode them on the other page depending on how u doingit

DimisD
02-09-2007, 03:15 PM
The 1st page (my page), has encoding charset=utf-8
The target page has encoding charset=iso-8859-7. The target page is a greek search engine page, so i don't have access in it. (Something like google, but, searches domains only in .gr or in greek language - www.trinity.gr).

What happens is, when the input textField characters of the 1st page, are written
a) in english language, then all are OK, but
b) when are written in greek language, the target page doen't recognise them, so it does not presents results.

Any ideas??:confused:

neomaximus2k
02-09-2007, 05:25 PM
apart from changing your charset to iso-8859-7 then no i have never come across a way of changing the characterset of a page.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum