Created
October 3, 2018 21:07
-
-
Save jesselau76/e2c1c5980caf05a1ee8d9f44ce951dfd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <p>Manticore Search: <input id="manticoresearch" name="search" type="text" /><br /> | |
| <button type="button" onclick="displaysort()">Manticore Search</button></p> | |
| <div id="sort" style="display: none;"> | |
| <form> | |
| <select name="users" id="sortoption" onchange="search(this.value)"> | |
| <option value="1">Sorting by:</option> | |
| <option value="1">Relevance</option> | |
| <option value="2">Latest Date</option> | |
| </select> | |
| </form> | |
| </div> | |
| <div id="searchresult"></div> | |
| <script> | |
| function displaysort() { | |
| var q=document.getElementById("manticoresearch").value; | |
| if (q==""){ | |
| return; | |
| } | |
| var x = document.getElementById("sort"); | |
| if (x.style.display === "none") { | |
| x.style.display = "block"; | |
| } | |
| var sort= document.getElementById("sortoption").value; | |
| search(sort); | |
| } | |
| function search(str) { | |
| if (str=="") { | |
| return; | |
| } | |
| if (window.XMLHttpRequest) { | |
| // code for IE7+, Firefox, Chrome, Opera, Safari | |
| xmlhttp=new XMLHttpRequest(); | |
| } else { // code for IE6, IE5 | |
| xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); | |
| } | |
| xmlhttp.onreadystatechange=function() { | |
| if (this.readyState==4 && this.status==200) { | |
| document.getElementById("searchresult").innerHTML=this.responseText; | |
| } | |
| } | |
| var q=document.getElementById("manticoresearch").value; | |
| // | |
| xmlhttp.open("GET","manticoresearch.php?q="+q+"&sort="+str,true); | |
| xmlhttp.send(); | |
| } | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment