← Back
Editing: nazioni.php
<html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Ajax Auto Suggest</title> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" language="javascript"> function lookup(inputString) { var myWidth = 0, myHeight = 0; if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } if(inputString.length == 0) { // Hide the suggestion box. $('#suggestions').hide(); } else { $.post("rpc.php", {queryString: ""+inputString+"-"+myWidth+""}, function(data){ if(data.length >0) { $('#suggestions').show(); $('#autoSuggestionsList').html(data); } }); } } // lookup function fill(thisValue) { $('#inputString').val(thisValue); setTimeout("$('#suggestions').hide();", 200); } //--> </script> <style type="text/css"> body { font-family: Helvetica; font-size: 11px; color: #000; } h3 { margin: 0px; padding: 0px; } .suggestionsBox { left: 5px; margin: 0px 0px 0px 0px; width: 200px; -moz-border-radius: 7px; -webkit-border-radius: 7px; border: 1px solid #999; background: #fff; } .suggestionList { margin: 0px; padding: 0px; } .suggestionList li { margin: 0px 0px 0px 0px; padding: 3px; cursor: pointer; list-style-type: none; } .suggestionList li:hover { color: #fff; background-color: #333; font-weight: bold; } </style> </head> <body> <div align="center"> <form method="post"> <table><tr><td width="200" valign="top">TEST</td><td> <div> <input autocomplete="off" name="nazione" type="text" size="20" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" /> </div> <div id="suggestions" style="display: none;"> <div class="suggestionList" id="autoSuggestionsList"> </div> </div> </div> </td></tr> <tr><div><td colspan="2">scrivi le prime lettere della nazione scelta</div> </td></tr></table> </form> </body> </html>
Save File
Cancel