87,904
社区成员
发帖
与我相关
我的任务
分享
<!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=utf-8">
<title>幻灯片</title>
<style type="text/css">
*{ font-family:verdana; font-size:12px;}
</style>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
幻灯片/视频播放
<ul id="imageList" style="display:none;">
<li><img videoURL="xpath/mp4File01.mp4" src="http://avatar.profile.csdn.net/5/1/9/2_shenzhennba.jpg" width="10" height="10"></li>
<li><img videoURL="xpath/mp4File02.mp4" src="http://avatar.profile.csdn.net/D/3/0/2_songweida8076.jpg" width="10" height="10"></li>
<li><img videoURL="xpath/mp4File03.mp4" src="http://avatar.profile.csdn.net/F/5/C/2_semanwmj.jpg" width="10" height="10"></li>
<li><img videoURL="xpath/mp4File04.mp4" src="http://avatar.profile.csdn.net/5/0/D/2_nibaohua.jpg" width="10" height="10"></li>
<li><img videoURL="xpath/mp4File05.mp4" src="http://avatar.profile.csdn.net/9/8/4/2_yangting_lisa.jpg" width="10" height="10"></li>
</ul>
<div id="picbox" style="border:1px solid red; text-align:center;">
<img id="showPic" src="http://avatar.profile.csdn.net/5/1/9/2_shenzhennba.jpg" width="400" height="300">
<div id="videoBox" style="display:none;"></div>
<div id="btnBox"><br><br>
<a href="javascript:playVideo();">play Video</a> | <a href="javascript:stopVideo();">stop Video</a>
<br>
</div>
</div>
<script language="javascript" type="text/javascript">
var oConfig={
playerID:'', //video ID
picList:[], //pic list
videoList:[], //video list
curVideo:'', //save current video URL
i:0,
init:function(){
$('#imageList img').each(function(){
oConfig.picList.push($(this).attr('src'));
oConfig.videoList.push($(this).attr('videoURL'));
});
oConfig.curVideo=oConfig.videoList[0];
}
};
var changePic=function(){
oConfig.i++;
if(oConfig.i>=oConfig.picList.length) oConfig.i=0;
$('#showPic').attr('src',oConfig.picList[oConfig.i]);
$('#showPic').attr('videoURL',oConfig.videoList[oConfig.i]);
oConfig.curVideo=oConfig.videoList[oConfig.i]
}
function playVideo(){
var vURL=$.trim(oConfig.curVideo);
if(vURL=='') return;
var oPic=$('#showPic');
var vBox=$('#videoBox');
var strHTML="";
//create video player code here,根据自己的播放代码适当在这里修改
//需要安装 Windows Media Player[version=9+]等或其他对应的播放器/插件,
strHTML+='<object classid="clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95" id="mediaplayer" width="400" height="300">';
strHTML+='<embed>';
strHTML+='<param name="SRC" value="'+vURL+'">';
strHTML+='</embed>';
strHTML+='</object>';
strHTML+='<br>video: '+vURL;
vBox.html(strHTML);
clearInterval(oConfig.playerID);
oPic.hide();
vBox.show();
}
function stopVideo(){
var oPic=$('#showPic');
var vBox=$('#videoBox');
vBox.hide('');
oPic.show();
}
$(document).ready(function(){
oConfig.init();
$('#showPic').mouseover(function(){
oConfig.playerID=setInterval(function(){changePic();},2000);
});
$('#showPic').mouseout(function(){
//$('#showPic').attr('src',oConfig.picList[0]);
// oConfig.i=0;
clearInterval(oConfig.playerID);
});
});
</script>
</body>
</html>
<!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=utf-8">
<title>幻灯片</title>
<style type="text/css">
*{ font-family:verdana; font-size:12px;}
</style>
<script language="javascript" type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.3/jquery.min.js"></script>
<script language="javascript" type="text/javascript">
</script>
</head>
<body>
幻灯片
<ul id="imageList" style="display:none;">
<li><img src="http://avatar.profile.csdn.net/5/1/9/2_shenzhennba.jpg" width="10" height="10"></li>
<li><img src="http://avatar.profile.csdn.net/D/3/0/2_songweida8076.jpg" width="10" height="10"></li>
<li><img src="http://avatar.profile.csdn.net/F/5/C/2_semanwmj.jpg" width="10" height="10"></li>
<li><img src="http://avatar.profile.csdn.net/5/0/D/2_nibaohua.jpg" width="10" height="10"></li>
<li><img src="http://avatar.profile.csdn.net/9/8/4/2_yangting_lisa.jpg" width="10" height="10"></li>
</ul>
<div id="picbox" style="border:1px solid red; text-align:center;">
<img id="showPic" src="http://avatar.profile.csdn.net/5/1/9/2_shenzhennba.jpg" width="200" height="100">
</div>
<script language="javascript" type="text/javascript">
var oConfig={
playerID:'',
picList:[],
i:0,
init:function(){
$('#imageList img').each(function(){
oConfig.picList.push($(this).attr('src'));
});
}
};
var changePic=function(){
oConfig.i++;
if(oConfig.i>=oConfig.picList.length) oConfig.i=0;
$('#showPic').attr('src',oConfig.picList[oConfig.i]);
}
$(document).ready(function(){
oConfig.init();
$('#showPic').mouseover(function(){
oConfig.playerID=setInterval(function(){changePic();},2000);
});
$('#showPic').mouseout(function(){
$('#showPic').attr('src',oConfig.picList[0]);
oConfig.i=0;
clearInterval(oConfig.playerID);
});
});
</script>
</body>
</html>