Tue Aug 07, 2007 12:18 pm
// Ajaxsc.js
// doSuggest
/*
Writen by Mohamed Sami
Developer
Information Technology
mail :[email protected]
*/
function doSuggest(word) {
if(word.length>0)
{
var request=null;
if (window.XMLHttpRequest) {
request = new XMLHttpRequest();
} else if (window.ActiveXObject) {
request = new ActiveXObject("Microsoft.XMLHTTP");
}
if(request)
{
var url="Page1.jsp";
url+="?suggestword="+word;
request.open("POST",url);
request.onreadystatechange = function()
{
if(request.readyState==4)
{
document.getElementById("theResults").innerHTML=request.responseText;
document.getElementById("theResults").style.visibility="visible";
}
}
request.send(null);
}
else
{
alert("Your browser don't support AJax !");
}
}
else
{
document.getElementById("theResults").innerHTML="";
document.getElementById("theResults").style.visibility="hidden";
}
}
<!--
Writen by Mohamed Sami
Developer
Information Technology
mail :[email protected]
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<TITLE>Page1.jsp</TITLE>
</HEAD>
<BODY>
<%
String suggetsword=request.getParameter("suggestword").toLowerCase();
String[] mySuggests=new String[]{"Anna","Apple","An","America","Ali","Ahmed"
,"Brittany","Ball","Cinderella","Car","Diana","Door","Eva","Ear"
,"Fiona","Fan","Gunda","Game","Hege","High","Inga","India","Johanna","Joomla"
,"Kitty","Kitkat","Linda","Loser","Nina","Noise","Ophelia","Open","Petunia"
,"People","Amanda","Area","Raquel","Rar","Cindy","Close","Doris","Do","Eve"
,"Event","Evita","Sunniva","Sun","Tove","Tall","Unni","Under","Violet","Vote"
,"Liza","Land","Elizabeth","English","Ellen","Wenche","Water","Vicky","Vila"};
out.println("<table width='100%' border='0' cellpadding='0' cellspacing='0'>");
for(int i=0;i<mySuggests.length;i++)
{
if(mySuggests[i].toLowerCase().startsWith((suggetsword.substring(0,1))))
{
out.print("<tr><td>"+mySuggests[i]+"</td></tr>");
}
}
out.println("</table>");
%>
</BODY>
</HTML>
<!--
Writen by Mohamed Sami
Developer
Information Technology
mail :[email protected]
-->
<HTML>
<HEAD>
<script type="text/javascript" src="Ajaxsc.js"></script>
<TITLE>index.html</TITLE>
</HEAD>
<BODY>
<INPUT type="text" size="50" id="text1" onkeyup="doSuggest(this.value);" />
<br/>
<div id = "theResults" style =
"width:22em;border:1px black solid;padding-left:2px;padding-right:2px; visibility: hidden">
</div>
</BODY>
</HTML>
Thu Aug 05, 2010 12:15 pm
Sat Aug 07, 2010 12:35 am
Thu Aug 19, 2010 7:48 am
Wed Dec 29, 2010 9:52 am
Tue Jan 17, 2012 3:58 pm
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.