JavaScript - Search Bar
Good Day:
I am building a small website that lists the local restaurants in the area. I would like to have a search bar at the top of the page so the user could type in the name of the restaurant and it takes you to my review. The way I have it set now, is the user has to scroll down to find the restaurant. The saerch bar would be much easier. Thanks in advance for any and all assistance. Similar TutorialsIn this case, Let's take Google Search as example: The code is JScript .NET, which is basically a .NET version of Javascript. Regardless of language, Anyone with appending type of skill can answer my question. This code is used in Fiddler(It's a Man-in-the-middle proxy) Code: if (oSession.uriContains("&q=")) // oSession is a Fiddler object session // uriContains() function, checks for case-insensitive string from the URI { var str = oSession.fullUrl; var sAppend = "test1+test2+test3"; if (!oSession.uriContains(sAppend)) { oSession.fullUrl = str.replace( "&q=","&q="+sAppend); } } For those who are confused, It says, If &q= is present in the URI, replace/append &q= with &q=test1+test2+test3 Problem: It appends test1+test2+test3 instantly, when it sees &q= in the URL. Basically, how do I make it wait until I click the submit/search button Thank you. Update: I heard about Onsubmit() event, but not really familiar with it. How do I use it? like, should I go to google source page and edit the form id? Also, Any other methods besides Onsubmit()? Hi experts, is it possible via Javascript to search certain websites with certain keywords without having to use specific search engines? example search only the following: 1. www.yyy.com 2. www.aaa.com 3. www.zzz.com for the keyword "Laminat" and open the sites accordingly. thx Hi Everyone! I have a website that I'm designing where I have the need to search multiple sites at specific times. By this I mean that In some cases, we would want to search only the internet using google, or only search the site that I've created (which currently uses the jse_search.js solution), or only our company's website. I currently have four different search boxes that will search either the internet, the internal site, a separate internal site, or a third-party website, which all working fine. The problem is that the search boxes take up quite a bit of space, and the layout is becoming cumbersome. Is there a way in Javascript I could use a single search box and a drop-down list to select which method to use? The code I'm currently using is below. With the exception of the Google search function, I've modified some of the site names to general site names and paths to preserve the company's anonymity: Code in the <head> tag: Code: <script language="JavaScript1.3" type="text/javascript" src="jse_form.js"> </script> Code in the <body> tag: Code: <!--Begin Internal Site Search 1!--> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td><form name="jse_Form" onsubmit="search_form(jse_Form);return false"> <input type="text" name="d" size="30"> </tr></td> <tr><td> <input type="button" value="Internal Site Search 1" onclick="search_form(jse_Form)"> </form> </tr></td> </table> <!--End Internal Site Search 1!--> <!--Begin Internal Site Search 2!--> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <!--webbot bot="Search" S-Index="all" S-Fields S-Text="Search for:" I-Size="20" S-Submit="Start Search" S-Clear="Reset" S-TimestampFormat="%m/%d/%Y" TAG="BODY" b-useindexserver="1" startspan --> <form action="http://sitesearch2.idq" method="POST"><input type="text" name="UserRestriction" size="30" value> </tr></td> <tr><td style="text-align: center;"> <input type="submit" value="Internal Site Search 2"></form> </form> <!--webbot bot="Search" i-checksum="4210" endspan --> </td></tr> </table> </div> <!--End Internal Site Search!--> <!--Begin Google Search!--> <form method="get" action="http://www.google.com/search"> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <input type="text" name="q" size="30" maxlength="233" value="" /> </tr></td> <tr><td align="center"> <input type="submit" value="Google Search" /></td></tr> </table> </div> </form> <!--End Google Search!--> <!--Begin Third Party Search!--> <form id="keywordSearchForm" method="get" action="http://www.site3.html"> <div> <p style="text-align: center;"> <table border="0" cellpadding="0"> <tr><td> <input class="input" type="text" name="keyword" size="30" /> </tr></td> <tr><td align="center"> <input type="hidden" name="origin" value="keywordsearch" /><input id="go" class="button" tabindex="0" type="submit" value="Third Party Search" /> </td></tr> </table> </div> </form> <!--End Third Party Site Search!--> Hello people. I'm looking to create a simple search engine capable of searching multiple search engines simultaneously together (e.g. Google, Bing, Yahoo, etc.) and then displaying the results below for all sites on the same page. I don't want each search engine results page opening up in individual windows or anything, nor do I want people to have to manually select the search engine to search with. Just a single page where a user types in something, pressed [Enter] and then presented with all results from multiple sites on one page (without duplicates). I'm also looking to do this with image and torrent sites, etc. How would I go about doing this? Thanks a million guys. You have bigger brains than me. I have my own multi option search bar html Code: <form name="searchform" action="http://www.google.com/search?q=" onsubmit="return dosearch();"> Search: <select name="sengines"> <option value="http://www.google.com/search?q=">Google</option> <option value="http://search.yahoo.com/search?q=">Yahoo</option> <option value="http://www.bing.com/search?q=">Bing</option> <option value="http://www.playlist.com/searchbeta/tracks#">Playlist</option> <option value="http://www.youtube.com/results?search_query=">Youtube</option> <option value="http://www.hulu.com/search?query=">Hulu</option> <option value="http://www.tv.com/search.php?type=11&stype=all&tag=search%3Bfrontdoor&qs=">TV.com</option> <option value="http://www.ask.com/web?q=">Ask</option> <option value="http://www.answers.com/topic/">Answers</option> <option value="http://www.ehow.com/search.aspx?s=">eHow</option> <option value="http://en.wikipedia.org/wiki/">Wikipedia</option> <option value="http://search.forbes.com/search/find?tab=searchtabgeneraldark&MT=">Forbes</option> </select> For: <input type="text" name="searchterms" /> <input class="button" type="submit" name="SearchSubmit" value="Search" /> </form> javascript (external) Code: function dosearch() { var sf=document.searchform; var submitto = sf.sengines.options[sf.sengines.selectedIndex].value + escape(sf.searchterms.value); window.location.href = submitto; return false; } but I want to have a second drop-down menu. I just can't get the 2nd one have everything still work. Can some benevolent sheep-guider-person (whatever they're called) help me? Thanks in advance, man with unnecessary phallic staff. Hi How can I use this code so that it searches for multiple strings? if(document.URL.indexOf("strings here") > 0){ Regards Mark I'm not sure if this is the right forum, but I'm looking for help with adding a search box to my website. I want to create a keyword search box - one where entering the right keyword(s) will take the visitor DIRECTLY to the page they're looking for, without a results page. And if they don't enter a keyword (in a keyword database?) they're taken to an error page. So, in essence, it's not really a search engine, it's more of a keywords box. Oh, also, some of the keywords will have non alphabetical or numerical characters (like dashes and periods) if that's a concern. Can someone help me with this or point me in the right direction to someone/someplace that can? Thanks.
I am using javascript to search for the '*' character in a string (ie. 'username*:') but using search('\*') does not work. How do I search for it since the search function takes a regexp argument and * messes that up?
i want to search the index.xml file throu diff input like combo box and input text shown in the search.html file and output the result in a tale. search.html Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html><head><meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>Search</title> <script type="text/javascript" src="search%20xml/search%20xml%20with%20mouseover%20table/searchindex.js"></script> </head><body> <form name="frmMain" id="frmMain" action=""> <b>Search Document: <br> <br> <br> Choose Book <select name="Select1"> <option selected="">--All--</option> <option>b1</option> <option>b2</option> </select><br> <br> Choose year <select name="Select2"> <option selected="">--All--</option> <option>1979</option> <option>1980</option> </select><br> </b><br> <strong>Doc_No</strong> <input name="Text1" type="text"><br> <br> <strong>Subject</strong> <input name="Text2" type="text" style="width: 356px"><br> <br> <input value="Submit" onclick="searchIndex(); return false;" type="submit"> </form> </body> </html> index.xml Code: <?xml version="1.0" ?> <books> <book name="b1"> <year date="1979"> <Document Doc_No="17" Subject="s1" path="ta3amime\1979\17_1979.tif">17_1979_s1.tif</Document> <Document Doc_No="18" Subject="s2" path="ta3amime\1979\18_1979.tif">18_1979_s2.tif</Document> </year> <year date="1980"> <Document Doc_No="19" Subject="s3" path="ta3amime\1980\19_1980.tif">19_1980_s3.tif</Document> <Document Doc_No="6" Subject="s4" path="ta3amime\1980\6_1980.tif">6_1980_s4.tif</Document> <Document Doc_No="1" Subject="s5" path="ta3amime\1980\1_1980.tif">1_1980_s5.tif</Document> <Document Doc_No="7" Subject="s6" path="ta3amime\1980\7_1980.tif">7_1980_s6.tif</Document> <Document Doc_No="4" Subject="s7" path="ta3amime\1980\4_1980.tif">4_1980_s7.tif</Document> </year> </book> <book name="b2"> <year date="1979"> <Document Doc_No="8" Subject="s8" path="ta3amime\1979\8_1979.tif">8_1979_s8.tif</Document> <Document Doc_No="7" Subject="s9" path="ta3amime\1979\7_1979.tif">7_1979_s9.tif</Document> </year> <year date="1980"> <Document Doc_No="9" Subject="s10" path="ta3amime\1980\9_1980.tif">9_1980_s10.tif</Document> <Document Doc_No="1" Subject="s11" path="ta3amime\1980\1_1980.tif">1_1980_s11.tif</Document> <Document Doc_No="8" Subject="s12" path="ta3amime\1980\8_1980.tif">8_1980_s12.tif</Document> <Document Doc_No="14" Subject="s13" path="ta3amime\1980\14_1980.tif">14_1980_s13.tif</Document> <Document Doc_No="16" Subject="s14" path="ta3amime\1980\16_1980.tif">16_1980_s14.tif</Document> </year> </books> searchindex.js Code: window.onload = loadIndex; function loadIndex() { // load indexfile // most current browsers support document.implementation if (document.implementation && document.implementation.createDocument) { xmlDoc = document.implementation.createDocument("", "", null); xmlDoc.load("index.xml"); } // MSIE uses ActiveX else if (window.ActiveXObject) { xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); xmlDoc.async = "false"; xmlDoc.load("index.xml"); } } // What would be the searchIndex() function ????? // Result in a table Hi all, I'm looking to find a way to making a FAQ selection search which has a hierarchy effect. For example: Whats your favorite color? Red Blue Green Say you select red What shade of red do you prefer? Dark Light Say you select Light Final page that will contain the information that you had rounded down through the search. Does any one have any ideas on how I can do this as I cant seem to find anything on the net! Thanks I'm doing some kind of MP3 Player search in javascript form using the URL from http://beemp3.com/index.php?p= then after the = any user will type the song they want to search and it'll appear as a valid URL search data under beemp3.com. The page is in http://stereowired.wehostyour.info/searchid.html. My problem is getting the value in .superform whenever the onChange occurs. this.value() doesn't work. I need some kind of alternative thanks oh yeah and the whole code Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <title>MP3 Search Engine</title> <style type="text/css"> *{font-family:"georgia","times new roman"} body{padding:0;margin:0;background:#fff;color:#000;} .center{text-align:center;width:64%;margin:0 auto;} .formatt{width:100%;height:36px;display:block;} .superform{float:left;width:73%;padding:5px 0;border:2px inset #a0a0a0;background:#e8e8e8;font-size:17px;color:#555;text-align:center;display:block;margin-top:1px;text-shadow:1px 1px 0 #fff;} .superform:hover{background:#d8d8d8} .supersubmit{float:right;width:25%;padding:5px 0;border:2px outset #333;background:#434343;font-size:17px;color:#999;display:block;margin-left:1%;text-shadow:1px 1px 0 #121212;} .supersubmit:focus{border-style:inset;color:#fff} #jam{width:100%;display:block;clear;both;border:0;height:600px;} </style> </head> <body> <div class="center"><h2>Stereo wired Search Engine</h2><div class="formatt"> <input class="superform" type="name" onChange="document.getElementById('jam').src="http://beemp3.com/index.php?q="+this.value()+"" /><input class="supersubmit" type="submit" value="Search" /></div> <iframe id="jam" src="http://beemp3.com"></iframe></div> </body></html> Ive been using js scripts for purposes of place links and banners randomly on web pages. Thing that is troubling me is that the links that are seen on page and not seen in the source code. Also, "spider view" tools that show the content and links are not seen/found by search engines, seems to suggest that links and anchor text is not seen by the crawler agent... Seems unlikely to me that the crawlers do not correctly register or index either the text or the link when ranking and listing the page content. ?? Can someone that knows describe what the situation is with regard to js and whether i should switch to php and server side includes to ensure that the links and anchor text is correctly registered. thanks.... i have a site where i sell vinyl graphics. i dont really want to use a full ecommerce CMS so search that way is out of the question. basically what i want is a search box where the user can type in keywords and it will display a page exactly like my products page but only showing products that are associated with that keyword. what would be the best way to go about doing this or is more than JS going to be needed?
Hey guys, im in need of some more java script help (by the way thanks for all the other times you guys have helped me) need to create a search box that whatever is in the search box will come up at the end of the URL https://****/DirectConnect/Getpremie...Chassis|X##### the last 6 charecters should be replaced with what ever number that in the search box so X##### should be replaced by 123456 for example or any other number I have a javascript that allows me to search text on a page. What I want to do is to limit the search area and not search the entire page. Can anyone help me with this? Here is an example page: http://merchantcertified.com/search.htm Hello, I have a search textbox field which populates the results in a dropdown after searched. But there is no way, to let users to explain to click or use the dropdown to see the results.. thus, I would like to have a focus on the dropdown, so after the user searches through the search textfield, and enter, the dropdown gets the focus so it will user friendly. can anyone help me on this. thank you in advance Hi, I am trying to make a search box...like the one Bing has...i am able to make one successfully..but the thing is i want to display the text inside the box..the one like Google custom search has...I am sure this is possible but just dont know how to make it work ...can you help me with the script or the links which can help me make a search box which displays text inside.... Thanks in Advance Not sure if it can be done with Javascript but is it possible to tell javascript to search for images that i have set and if they find them left click them once in a loop? and have it so i can pause and resume it? Thanks First off please forgive my ignorance, as I am very new to coding. I hope that I have posted this in the right place. I found a great piece of code that I would like to use for my site search. I found it he http://www.javascriptkit.com/script/...e_search.shtml Here is what I am attempting to do. I would like this piece of code to search all three of my domains, if this is possible. I would like to use this search box on all three of my websites, if this is possible. If you look at this site: www.kennedyassassinationresearch.com I would like to keep the look similar to what it is now, and use this code in the upper right corner of the header, where the black search box is now. Is any of this possible? the code I located is: Code: <form name="jksearch" action="http://www.google.com/search" method="get" onSubmit="jksitesearch(this)"> <p>Search JavaScript Kit:<br /> <input id="hiddenquery" type="hidden" name="q" /> <input name="qfront" type="text" style="width: 200px" value="navigator object" /> <input type="submit" value="Search" /><br /> <div style="font: bold 11px Verdana;">Google:<input name="se" type="radio" checked> *Yahoo:<input name="se" type="radio"> *MSN:<input name="se" type="radio"> </div> <script type="text/javascript"> // All-in-one Internal Site Search script- By JavaScriptKit.com (http://www.javascriptkit.com) // For this and over 400+ free scripts, visit JavaScript Kit- http://www.javascriptkit.com/ // This notice must stay intact for use //Enter domain of site to search. var domainroot="www.javascriptkit.com" var searchaction=[ //form action for the 3 search engines "http://www.google.com/search", "http://search.yahoo.com/search", "http://search.msn.com/results.aspx" ] var queryfieldname=["q","p","q"] //name of hidden query form for the 3 search engines function switchaction(cur, index){ cur.form.action=searchaction[index] document.getElementById("hiddenquery").name=queryfieldname[index] } function jksitesearch(curobj){ for (i=0; i< document.jksearch.se.length; i++){ //loop through radio to see which is checked if (document.jksearch.se[i].checked==true) switchaction(document.jksearch.se[i], i) } document.getElementById("hiddenquery").value="site:"+domainroot+" "+curobj.qfront.value } </script> </p> </form> <p style="font: normal 11px Arial">This free script provided by<br /> <a href="http://www.javascriptkit.com">JavaScript Kit</a></p> Any help is greatly appreciated, as this is a learning experience for me, and this has me quite confused. Thanks! The point is to type something like votillity.com and get votillity.com or google.com and get google.com HTML Code: <form name="searchformHTTP" action="HTTP()" onsubmit="return HTTP();"> <input style="position:fixed;top:0;left:49.15%;width:10%;" type="text" name="searchterms"/> <input class="buttonsearch" style="position:fixed;top:0;left:59.6%;" type="submit" name="SearchSubmit" value="!"/> <select name="HTTPops" style="position:fixed;top:0;left:61.7%;width:6%;"> <option value=".com">.com</option> </select> </form> (external) javascript Code: function HTTP() { var sfHTTP=document.searchformHTTP; var op=document.option[sfHTTP.HTTPops.selectedIndex]value; window.location.href = "http://"+sf.searchterms.value+"op"; return false; } |