Note that there are some explanatory texts on larger screens.

plurals
  1. POClose suggestion box when user click Clear button
    primarykey
    data
    text
    <ol> <li><p>How can I close the suggestion box when the user click the Clear button?</p></li> <li><p>When the suggestion box is closed, how can the Search &amp; Clear button move up to its original place?</p></li> </ol> <p>What code should I insert to do this?</p> <p>You can see the buttons when you run this code.</p> <p>This is my current code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt; Brandon's Search Engine &lt;/title&gt; &lt;style type="text/css"&gt; #suggestion { border: 1px solid black; visibility: hidden; position: relative; background-color: white; z-index: 10; } #suggestion a { font-size: 12pt; color: black; text-decoration: none; display: block; width: 648px; height: auto; text-align: left; padding: 2px; } #suggestion a:hover { background-color: #dddddd; width: 644px; padding: 2px; } &lt;/style&gt; &lt;script type="text/javascript"&gt; //document.getElementById("suggestion") function getSuggestion(q) { var ajax; if(window.XMLHttpRequest)//for ie7+, FF, Chrome ajax = new XMLHttpRequest();//ajax object else ajax = new ActiveXObject("Microsoft.XMLHTTP");//for ie6 and previous ajax.onreadystatechange = function() { if(ajax.status === 200 &amp;&amp; ajax.readyState === 4) { //if result are not there then don't display them if(ajax.responseText === "") document.getElementById("suggestion").style.visibility = "hidden"; else { document.getElementById("suggestion").style.visibility = "visible"; document.getElementById("suggestion").innerHTML = ajax.responseText; } } }; ajax.open("GET", "suggestion.php?q=" + q, false); ajax.send(); } &lt;/script&gt; &lt;script&gt; function validateForm() { var x=document.forms["q"]["q"].value; if (x==null || x=="") { return false; } } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form method="GET" action="search.php" name="q" onsubmit="return validateForm()"&gt; &lt;table align="center"&gt; &lt;tr&gt; &lt;td&gt; &lt;h1&gt;&lt;center&gt;Brandon's Search Engine&lt;/center&gt;&lt;/h1&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center"&gt; &lt;input type="text" name="q" style="height: 27px; width: 650px; padding: 2px" onkeyup="getSuggestion(this.value)" autocomplete="off" onblur="blur() document.getElementById('suggestion').style.visibility = 'hidden'"/&gt; &lt;div id="suggestion" style="width: 648px"&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center"&gt; &lt;input type="submit" name="submit" value="Search" style="height: auto; width: 60px; padding: 2px" /&gt; &lt;input type="reset" value="Clear" style="height: auto; width: 50px; padding: 2px" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td align="center"&gt; To insert your site in result fill in the form at &lt;a href="insert.php"&gt;here&lt;/a&gt;. &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;input type="hidden" name="page" value="0" /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Hope that someone can help me out with this</p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload