Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Google custom search engine

    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>

  • #2
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Not had chance to test the script but this should work

    Code:
    <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
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #3
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Now it works!

    Excellent solution "neomaximus2k"!!!

    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?

    Again thank you !!!!

  • #4
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #5
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 ?


    thank you

  • #6
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)

  • #7
    New Coder
    Join Date
    Feb 2007
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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??

  • #8
    Regular Coder
    Join Date
    Jan 2007
    Posts
    213
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    Matthew Bagley
    Paramiliar Design Studios
    Website Design | Website Development | Search Engine Optimisation (SEO)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •