JavaScript gets playback address and lyrics based on song name _javascript tips

Source: Internet
Author: User
To all of you, to do online listening to songs, without their, because the use of the external jquery.js file, so run the code after the page to refresh the effective!
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <ptml xmlns=" http://www.w3.org/1999/xhtml "> <HEAD><TITLE> listening to song </TITLE> <meta Http-equiv=content-type content= "text/html; Charset=utf-8 "> <script type=" text/javascript "src=" Http://img.jb51.net/jslib/jquery/jquery-1.3.2.min.js " ></script> <script> $ (function () {$ ("#surl"). Bind ("click", Function () {$ ("#surl"). attr ("Disabled", true); var song = encodeURI ($ ("#kw"). Val ()); Song = encodeURI (song); var str = "<ul>"; $.getjson ("http://www.faqee.com/crm/song?act=songurl&song=" +song+ "&jsoncallback=?", function (JSON) {$ . each (Json,function (i,n) {n = n+ ""; i = i+ ""; if (i!= "res") {var ss = <li> Pending: "+n+ </li>"; STR=STR+SS; }else{if (n = = "0") {alert ("Sorry, can't search the song!") "); $ ("#surl"). attr ("disabled", false); Return } } }); str = str+ "</ul>"; $ ("#searchsesult"). html (str); $ ("#surl"). attr ("disabled", false); }); }); $ ("#slrc"). Bind ("click", Function () {$ ("#slrc"). attr ("Disabled", true); var song = encodeURI ($ ("#kw"). Val ()); Song = encodeURI (song); var str = ""; $.getjson ("http://www.faqee.com/crm/song?act=songlrc&song=" +song+ "&jsoncallback=?", function (JSON) {$ . each (Json,function (i,n) {n = n+ ""; i = i+ ""; if (i!= "res") {$ ("#searchsesult"). HTML (n); $ ("#slrc"). attr ("disabled", false); Return }else{if (n = = "0") {alert ("Sorry, no lyrics to search!") "); $ ("#slrc"). attr ("disabled", false); Return } } }); }); }); }); </script> </pead> <body> <p/><p/> <div > Search: <input type= "text" id= "kw" Valu E= "Country"/>   <input type= "button" value= "Search song Address" id= "sURL"/>   <input "button" value= "Search LRC Lyrics" id= "SLRC"/> <div id= "Searchsesult" ></div> </div> </body> </ptml>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]
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.