Online lyrics search function made by ajax technology

Time:2022-8-13
copy codecode show as below:
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>Untitled document</title>
</head>
<body>
<style type=”text/css”>
<!–
body {
background-color: #FFFFFF;
font-size: 85%;
font-family: Verdana;
margin-top : 10px;
margin-left : 10px;
}
a:link{color:#3737c8}
a:active {color: #f00;}
a:visited {color:#639;}
–>
</style>
<script language=”javascript”>
    var http_request = false;
function send_request(url) {//Initialization, specifying the processing function, the function to send the request
       http_request = false;
//Start initializing the XMLHttpRequest object
if(window.XMLHttpRequest) { //Mozilla browser
           http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) {//Set MiME category
             http_request.overrideMimeType(‘text/xml’);
         }
       }
else if (window.ActiveXObject) { // IE browser
            try {
               http_request = new ActiveXObject(“Msxml2.XMLHTTP”);
           } catch (e) {
                try {
                  http_request = new ActiveXObject(“Microsoft.XMLHTTP”);
                } catch (e) {}
            }
       }
if (!http_request) { // exception, failed to create object instance
window.alert(&quot;Cannot create XMLHttpRequest object instance.&quot;);
            return false;
        }
        http_request.onreadystatechange = processRequest;
// Determine the method and URL to send the request and whether to execute the next code synchronously
       http_request.open(“GET”, url, true);
       http_request.send(null);
    }
// function to handle the returned information
    function processRequest() {
if (http_request.readyState == 4) { // Determine the state of the object
if (http_request.status == 200) { // The message has been returned successfully, start processing the message
               //alert(http_request.responseText);
               document.getElementById(“result”).innerHTML = http_request.responseText;
} else { //The page is abnormal
alert(&quot;The page you requested is abnormal.&quot;);
            }
       }
    }
   function dosearch() {
        var f = document.form1;
       var geci = f.geci.value;
       if(geci==””) {
window.alert(&quot;Please enter the lyrics you want to query&quot;);
           f.geci.focus();
           return false;
       }
        else {
document.getElementById(&quot;result&quot;).innerHTML=&quot;Querying, please wait&quot;;
            send_request(‘http://www.efish.cn/getgeci.aspx?m=’+escape(geci));
        }
   }
    function submitForm() { 
       if(window.event.keyCode==13) { 
           dosearch();
       } 
   } 
</script>
<p></p><p></p>
<form id=”form1″ name=”form1″ method=”post” action=””>
<center><span style=”font-size:18px; color:#FF0000″>100,000 lyrics free online query</center>
<p></p>
Please enter the song name:
  <input name=”geci” type=”text” id=”geci” value=”东风破” size=”60″ height=”30″ maxlength=”50″ onKeyDown=”submitForm()”  />
  <input type=”button” name=”search” value=”查询歌词” onClick=”dosearch()”><br />
  <span id=”result”></span>
</form>
</body>
</html>