类似百度歌词随歌显示

 

<!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" />
<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">

<title>无标题文档</title>
</head>
<body>
<object id="mplayer" width="120" height="45" classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
align="baseline" border="0" standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="FileName" value="再度重相逢.mp3">
<param name="ShowControls" value="1">
<param name="ShowPositionControls" value="0">
<param name="ShowAudioControls" value="0">
<param name="ShowTracker" value="1">
<param name="ShowDisplay" value="0">
<param name="ShowStatusBar" value="0">
<param name="AutoSize" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowCaptioning" value="0">
<param name="AutoStart" value="0">
<param name="PlayCount" value="0">
<param name="AnimationAtStart" value="0">
<param name="TransparentAtStart" value="0">
<param name="AllowScan" value="0">
<param name="EnableContextMenu" value="1">
<param name="ClickToPlay" value="1">
<param name="InvokeURLs" value="1">
<param name="DefaultFrame" value="datawindow"></object>
<div id="t"></div>
<div id="c"></div>
<div id="lrc" style="display:none">[00:00.00]伍佰-再度重相逢<br />
  [00:05.59]制作:刘建平<br />
  [00:20.09]QQ:33975183<br />
  [00:27.88]你说人生如梦<br />
  [00:32.61]我说人生如秀<br />
  [00:37.20]那有什么不同<br />
  [00:41.53]不都一样朦胧<br />
  [00:46.21]朦胧中有你<br />
  [00:50.13]有你跟我就已经足够<br />
  [00:56.21]你就在我的世界<br />
  [01:00.27]升起了彩虹<br />
  [01:04.02]简单爱你心所爱<br />
  [01:09.15]世界也变的大了起来<br />
  [01:13.94]所有花都为你开<br />
  [01:18.06]所有景物也为了你安排<br />
  [01:23.08]我们是如此的不同<br />
  [01:27.04]肯定前世就已经深爱过<br />
  [01:32.27]讲好了这一辈子<br />
  [01:36.19]再度重相逢 <br />
  [02:16.94]简单爱你心所爱<br />
  [02:20.39]世界也变的大了起来<br />
  [02:24.91]所有花都为你开<br />
  [02:29.09]所有景物也为了你安排<br />
  [02:34.14]我们是如此的不同<br />
  [02:38.10]肯定前世就已经深爱过<br />
  [02:42.94]讲好了这一辈子<br />
  [02:46.97]再度重相逢 <br />
  [02:51.33]我们是如此的不同<br />
  [02:55.87]肯定前世就已经深爱过<br />
  [03:00.89]讲好了这一辈子<br />
  [03:04.66]再度重相逢 <br />
  [03:10.47]简单爱你心所爱<br />
  [03:13.49]世界也变的大了起来<br />
  [03:18.20]所有花都为你开<br />
  [03:22.48]所有景物也为了你安排<br />
  [03:27.29]我们是如此的不同<br />
  [03:31.32]肯定前世就已经深爱过<br />
  [03:36.27]讲好了这一辈子<br />
  [03:40.22]再度重相逢<br />
  [03:46.16]我们是如此的不同<br />
  [03:49.37]肯定前世就已经深爱过<br />
  [03:53.94]讲好了这一辈子<br />
  [03:58.01]再度重相逢<br />
</div>
<script>
function get_time(){
 if (mplayer.PlayState == 2){
  var time = mplayer.CurrentPosition;
//  document.getElementById("t").innerHTML=time;
  var a_time = time.toString().split('.');
  var t = "";
  var m = Math.floor(a_time[0]/60);
  var s = Math.floor(a_time[0]%60);
  if (parseInt(a_time[0]) > -1){
   m = (m.toString().length>1?"":"0") + m;
   s = (s.toString().length>1?"":"0") + s;
   t = m + ":" + s + ".";
   if(a_time.length>1){
    t += a_time[1].substring(0,2);
   }
   else{
    t += "00";
   }
  }
  document.getElementById("t").innerHTML=t;
  var i = document.getElementById("lrc").innerHTML;
  var time = m + ":" + s;//'00:05';
  var regex = new RegExp("(\\[" + time + ".*?<br>)",'gi');
  //alert(i.replace(regex,'<font>$1</font>'));
  if(regex.test(i)){
   document.getElementById("c").innerHTML=i.replace(regex,'<font color=red>$1</font>');
  }
 }
 setTimeout('get_time()',100);
}
get_time();
function tt(){
var i = document.getElementById("lrc").innerHTML;
var time = '00:05';
var regex = new RegExp("(\\[" + time + ".*?<br>)",'gi');
//alert(i.replace(regex,'<font>$1</font>'));
document.getElementById("t").innerHTML=i.replace(regex,'<font color=red>$1</font>');
}
//tt();
</script>
</body>
</html>

你可能感兴趣的:(XHTML,function,百度,Microsoft,regex,border)