Ajax technology to create online lyrics search function

Source: Internet
Author: User
Tags object query return window
ajax| Online

The latest production of online lyrics search function, using AJAX technology, no refresh display lyrics, only need to enter the song you want to find the name or lyrics. The interface is not very good-looking, perfect ...

SOURCE Download Http://www.efish.cn/ajaxss.rar

1<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
234<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>
5<title> No title document </title>
67
8<body>
9<style type= "Text/css" >
10<!--
11body {
12background-color: #FFFFFF;
font-size:85%;
Font-family:verdana;
margin-top:10px;
margin-left:10px;
17}
18a:link{color: #3737c8}
19a:active {color: #f00;}
20a:visited {color: #639;}
21-->
22</style>
23<script language= "JavaScript" >
var http_request = false;
function send_request (URL) {//initialization, specifying handler functions, sending requests
num Http_request = false;
27//Start initialization of XMLHttpRequest objects
The If window. XMLHttpRequest) {//mozilla browser
Http_request = new XMLHttpRequest ();
(Http_request.overridemimetype) {//Set MIME category
Http_request.overridemimetype (' Text/xml ');
32}
33}
The Else if (window. ActiveXObject) {//IE browser
A try {
Http_request = new ActiveXObject ("Msxml2.xmlhttp");
Panax Notoginseng catch (e) {
try {
Http_request = new ActiveXObject ("Microsoft.XMLHTTP");
catch (e) {}
41}
42}
(!http_request) {//exception, creation of object instance failed
Window.alert ("Cannot create XMLHttpRequest object instance.");
return false;
46}
Http_request.onreadystatechange = ProcessRequest;
48//Determine the way and URL to send the request and whether to execute the next paragraph of code synchronously
Http_request.open ("Get", url, True);
Http_request.send (NULL);
51}
52//function to process return information
The function ProcessRequest () {
(Http_request.readystate = = 4) {//Judge object state
if (Http_request.status = 200) {//information has been successfully returned to begin processing information
//alert (Http_request.responsetext);
document.getElementById ("Result"). InnerHTML = Http_request.responsetext;
%} else {//Page not normal
Alert ("The page you are requesting has an exception.) ");
60}
61}
62}
The function Dosearch () {
The var f = document.form1;
The var geci = F.geci.value;
if (geci== "") {
Window.alert ("Please enter the lyrics you want to query");
F.geci.focus ();
return false;
70}
/else {
document.getElementById ("Result"). Innerhtml= "Being queried, please wait";
Send_request (' http://www.efish.cn/getgeci.aspx?m= ' +escape (GECI));
74}
75}
The function SubmitForm () {
(window.event.keycode==13) {
Dosearch ();
79}
80}
81</script>
82<p></p><p></p>
83<form id= "Form1" Name= "Form1" method= "Post" action= "" >
84<center><span style= "FONT-SIZE:18PX; Color: #FF0000 "> 100,000 lyrics online free enquiry </span></center>
85<p></p>
86 Please enter the song name:
<input name= "Geci" type= "text" id= "Geci" value= "Dongfeng Broken" size= "" height= "" "Maxlength=" "/>"
<input type= "button" name= "search" value= "Query lyrics" ><br
<span id= "Result" ></span>
90</form>
91</body>
92

Http://www.cnblogs.com/efish/archive/2006/09/21/510873.html



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.