View Full Version : HTML help
CiNiMoDZA
03-04-2008, 08:24 AM
Hey guys,
I know this is off game dev and everything, but Im hoping someone can help! I have no clue what to do!
Does anyone know how to add a google search bar to your site? Ive tried gooling it ( lol :P ) but found nothing!!! Please help!!!
Squid
03-04-2008, 10:23 AM
You just need some javascript.
This is how the one from the Dev.Mag site works:
<script type="text/javascript">
var domainroot="www.devmag.org.za"
function Gsitesearch(curobj){
curobj.q.value=curobj.qfront.value
document.srch.action=document.srch.ddl.value;
if (document.srch.ddl.value=="devmag")
curobj.q.value="site:"+domainroot+" "+curobj.qfront.value
if (document.srch.ddl.value=="devmag")
document.srch.action="http://www.google.com/search";
}
</script>
<form name=srch method="get" onSubmit="Gsitesearch(this)" action=xxxe><input name="q" type="hidden" />
<input name="qfront" type="text" class="searchbar"/>
<input type="submit" value="Search" class="searchbar" />
<select class="searchbar" name="ddl"><option class="searchbar" value="http://www.google.com/search" SELECTED>Google</option><option class="searchbar" value="http://www.google.com/images">Images</option><option class="searchbar" value="devmag">Dev.Mag</option></select></form>
You will notice that this features a drop down menu, a submit button and search bar. The top bit of code is the actual script that does the search according to the value of the search bar and drop down.
The script is called when the submit button is hit.
The drop down allows you to choose whether you want to search images, normal Google or the site in question.
CiNiMoDZA
03-04-2008, 02:07 PM
Hmm, thanks! I see what you saying, but could you post an example! Im still new to html and what not :P
FuzzYspo0N
03-04-2008, 02:24 PM
copy paste that into a blank html file and try it, it shud work if im not mistaken. change ur domain root if u want tho
Squid
03-04-2008, 03:04 PM
Just simply copy that code into your HTML file, somewhere between the <BODY> tags. Change the domainroot variable and that's it.
Here is a simpler version without the dropdown:
<script type="text/javascript">
var domainroot="www.mysite.co.za"
function Gsitesearch(curobj){
curobj.q.value=curobj.qfront.value
document.srch.action="http://www.google.com/search";
}
</script>
<form name=srch method="get" onSubmit="Gsitesearch(this)"><input name="q" type="hidden" />
<input name="qfront" type="text" class="searchbar"/>
<input type="submit" value="Search" class="searchbar" />
</form>
If you don't know the basics of HTML, there was a tutorial series in Dev.Mag. Starting here (http://www.devmag.org.za/viewissue.jsp?id=16)
CiNiMoDZA
14-04-2008, 10:02 AM
Hey guys, sorry, more help!!! How can I make a jump menu only change the main frame???
My code looks like this:
form name="form1" id="form1">
<select name="menu1" onchange="MM_jumpMenu('parent',this,0)">
<option value="main_search.html">Search</option>
<option value="main_abt_us.html">About Us</option>
<option value="main_boards.html">Boards</option>
<option value="boards/unfinished.html" selected="selected">Boards - Unfinished Surfaces</option>
<option value="boards/decorative.html">Boards - Decorative Surfaces</option>
<option value="boards/bisonbord.html">Boards - Unfinished - BisonBord</option>
whatever till the end, but is there anywhere that i can add a target="mainFrame" so that it only loads in the main frame???
Pietersielie
30-08-2008, 08:23 AM
If you want add the "target='mainFrame'" I think you can add in the <option> tag like:
<option target=" "> </option>
Powered by vBulletin® Version 4.2.4 Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.