在动态网站编写类似playmoview.do?filename=1.rm这样的代码通常根据参数调用相应的网页进行播放。但是 静态网站,则可以利用js对filename的值进行获取并设置一个伪动态的网页。不多说,看代码:
<table border="1" align="center" cellpadding="1" cellspacing="1" bordercolor="#3399FF">
<tr>
<td width="568" colspan="3" class="style4"><p align="center">实训实录 </p></td>
</tr>
<tr>
<td width="189" class="style4"><p align="left">土 </p></td>
<td width="189" class="style4"><p align="center"><a href="javascript:urlgetput('1.rm')">在线观看 </a></p></td>
<td width="189" class="style4"><p align="center"><a href="1.rm">视频下载 </a></p></td>
</tr>
<tr>
<td width="189" class="style4"><p align="left">砌筑 </p></td>
<td width="189" class="style4"><p align="center"><a href="javascript:urlgetput('2.rm')">在线观看 </a></p></td>
<td width="189" class="style4"><p align="center"><a href="2.rm">视频下载 </a></p></td>
</tr>
<tr>
<td width="189" class="style4"><p align="left">混凝土 </p></td>
<td width="189" class="style4"><p align="center"><a href="javascript:urlgetput('3.rm')">在线观看 </a></p></td>
<td width="189" class="style4"><p align="center"><a href="3.rm">视频下载 </a></p></td>
</tr>
<tr>
<td width="189" class="style4"><p align="left">钢筋</p></td>
<td width="189" class="style4"><p align="center"><a href="javascript:urlgetput('4.rm')">在线观看 </a></p></td>
<td width="189" class="style4"><p align="center"><a href="4.rm">视频下载 </a></p></td>
</tr>
<tr>
<td width="189" class="style4"><p align="left">项目费 </p></td>
<td width="189" class="style4"><p align="center"><a href="javascript:urlgetput('5.rm')">在线观看 </a></p></td>
<td width="189" class="style4"><p align="center"><a href="5.rm">视频下载 </a></p></td>
</tr>
</table>
js:
function getQueryStringRegExp(name)
{
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href))
return unescape(RegExp.$2.replace(/\+/g, " "));
return "";
};
function urlgetput(s)
{
if(s!=null)
{
str="play.html?rm="+s;
//parent.location.href=str;
window.open(str);
}
}
function play()
{
var str="<EMBED src="+getQueryStringRegExp('rm')+' width=350 height=350 type=audio/x-pn-realaudio-plugin console="Clip1" controls="IMAGEWINDOW,ControlPanel,StatusBar" autostart="true"></EMBED>'
document.write(str);
}
显示页面:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>录像</title>
</head>
<script type="text/javascript" src="do.js"></script>
<body>
<table width="100%">
<tr>
<td>
<table width="98%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="176" align=center>
<script type="text/javascript">
play();
</script>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
版权声明:本文为博主原创文章,未经博主允许不得转载。