资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
javascript 根据歌名获取播放地址和歌词内容
给大家吧,做在线听歌时,少不了他们的,由于用到了外部的jquery.js文件,所以运行代码后请重新刷新页面生效!
<!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><TITLE>听歌</TITLE> <META http-equiv=Content-Type content="text/html; charset=UTF-8"> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%20src%3D%22http%3A%2F%2Fimg.glzy8.com%2Fjslib%2Fjquery%2Fjquery-1.3.2.min.js%22%3E%3C%2Fscript%3E"> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0A%24(function()%7B%20%0D%0A%20%20%20%20%20%0D%0A%20%20%20%20%24(%22%23surl%22).bind(%22click%22%2Cfunction()%7B%20%0D%0A%20%20%20%20%20%20%20%20%24(%22%23surl%22).attr(%22disabled%22%2Ctrue)%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20song%20%3D%20encodeURI(%24(%22%23kw%22).val())%3B%20%0D%0A%20%20%20%20%20%20%20%20song%20%3D%20encodeURI(song)%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20str%20%3D%20%22%3Cul%3E%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%24.getJSON(%22http%3A%2F%2Fwww.faqee.com%2Fcrm%2Fsong%3Fact%3Dsongurl%26song%3D%22%2Bsong%2B%22%26jsoncallback%3D%3F%22%2C%20function(json)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24.each(json%2Cfunction(i%2Cn)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20n%20%3D%20n%2B%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20i%20%3D%20i%2B%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(i!%3D%22res%22)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20var%20ss%20%3D%20%22%3Cli%3E%E5%BE%85%E9%80%89%EF%BC%9A%3Ca%20href%3D%5C%22%23%5C%22%3E%22%2Bn%2B%22%3C%2Fa%3E%3C%2Fli%3E%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20str%3Dstr%2Bss%3B%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Delse%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(n%20%3D%3D%20%220%22)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert(%22%E6%8A%B1%E6%AD%89%EF%BC%8C%E6%90%9C%E7%B4%A2%E4%B8%8D%E5%88%B0%E6%AD%8C%E6%9B%B2%EF%BC%81%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23surl%22).attr(%22disabled%22%2Cfalse)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20str%20%3D%20str%2B%22%3C%2Ful%3E%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23searchsesult%22).html(str)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23surl%22).attr(%22disabled%22%2Cfalse)%3B%20%0D%0A%20%20%20%20%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%24(%22%23slrc%22).bind(%22click%22%2Cfunction()%7B%20%0D%0A%20%20%20%20%20%20%20%20%24(%22%23slrc%22).attr(%22disabled%22%2Ctrue)%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20song%20%3D%20encodeURI(%24(%22%23kw%22).val())%3B%20%0D%0A%20%20%20%20%20%20%20%20song%20%3D%20encodeURI(song)%3B%20%0D%0A%20%20%20%20%20%20%20%20var%20str%20%3D%20%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%24.getJSON(%22http%3A%2F%2Fwww.faqee.com%2Fcrm%2Fsong%3Fact%3Dsonglrc%26song%3D%22%2Bsong%2B%22%26jsoncallback%3D%3F%22%2C%20function(json)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%24.each(json%2Cfunction(i%2Cn)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20n%20%3D%20n%2B%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20i%20%3D%20i%2B%22%22%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(i!%3D%22res%22)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23searchsesult%22).html(n)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23slrc%22).attr(%22disabled%22%2Cfalse)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7Delse%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20if(n%20%3D%3D%20%220%22)%7B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20alert(%22%E6%8A%B1%E6%AD%89%EF%BC%8C%E6%90%9C%E7%B4%A2%E4%B8%8D%E5%88%B0%E6%AD%8C%E8%AF%8D%EF%BC%81%22)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%24(%22%23slrc%22).attr(%22disabled%22%2Cfalse)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20return%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%0D%0A%20%20%20%20%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%7D)%3B%20%0D%0A%20%20%20%20%20%0D%0A%7D)%3B%20%0D%0A%3C%2Fscript%3E"> </head> <body> <p/><p/> <div style="clear:both;text-align:left;margin:0;padding:0;"> 搜索: <input type="text" id="kw" style="width:250px;" value="国家"/> <input type="button" value="搜索歌曲地址" id="surl" /> <input type="button" value="搜索LRC歌词" id="slrc" /> <div id="searchsesult"></div> </div> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程