<h1>Drop Drown</h1>
<input type="text" id="text" onkeyup="show(event)"/>
<p id="view"></p>
<script>
var data = ["apple","banana","mango",
<input type="text" id="text" onkeyup="show(event)"/>
<p id="view"></p>
<script>
var data = ["apple","banana","mango",
"watermelon","orange","papaya"];
function show(event){
var text = document.getElementById('text').value;
var view = document.getElementById('view');
var len = text.length;
var plot = "";
if (len==0){
view.innerHTML = "";
return;
}
// we iterate all the available data to match on
function show(event){
var text = document.getElementById('text').value;
var view = document.getElementById('view');
var len = text.length;
var plot = "";
if (len==0){
view.innerHTML = "";
return;
}
// we iterate all the available data to match on
// the server
for(i=0;i<data.length;i++){
// we just take the query that match
for(i=0;i<data.length;i++){
// we just take the query that match
// the first main of the saved words on the server.
// for each length of the string.
// we compare if the query from the user
// for each length of the string.
// we compare if the query from the user
//is match the defined words.
if(text==data[i].substr(0,len)){
plot = plot+"<br/>"+data[i];
}
}
view.innerHTML = plot;
}
</script>
if(text==data[i].substr(0,len)){
plot = plot+"<br/>"+data[i];
}
}
view.innerHTML = plot;
}
</script>
No comments:
Post a Comment