HTML5新特性学习-1

时间:2022-01-12 07:04:14

本文在于巩固基础

新特性:音频的使用

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>播放音乐</title>
<link rel="stylesheet" type="text/css" href="Css/myCss.css"/>
<script src="Script/jquery-2.1.1.min.js"></script>
</head>
<body>
<div>
<h1>音乐播放</h1> <div>
<button id="btn" onclick="clickMe()">播放/暂停</button>
<audio id="audio" src="Source/Happiness.mp3" controls="controls"></audio> </div> </div>
<script type="text/javascript" src="Script/myScript.js"></script>
</body>
</html>
/**
* Created by Administrator on 2015/3/5 0005.
*/
function clickMe()
{
//$("#btn").css("background","red");
//$("#audio").css("background","red");
if($("#audio").get().paused)
{ $("#audio").get().play();
}
else
{
$("#audio").get().pause();
} }