kaiguan.html
1.33 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="../src/js/jquery-1.7.1.js"></script>
</head>
<body>
<div class="form-group">
<label class="col-sm-2 control-label">开启声音提醒</label>
<div class="col-sm-10">
<div id="switchV" style="width:65px;height:24px;background:#2f8ff7;margin-top:3px;cursor:pointer;overflow:hidden;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius:5px;" data="1" title="已开启">
<span style="position:absolute;margin:2px 2px 0px 2px;line-height:16px;padding:2px 7px; background:white;float:left;left:12px;-moz-border-radius: 5px;-webkit-border-radius: 5px;border-radius:5px;">关闭</span>
</div>
</div>
</div>
<script>
$(function() {
$('#switchV').click(function() {
var data = $(this).attr('data');
if (data == 1) //执行关闭声音播放操作
{
$(this).attr('data', 0).attr('title', '已关闭');
$(this).children('span').css('left', '35px').html('开启');
} else {
$(this).attr('data', 1).attr('title', '已开启');
$(this).children('span').css('left', '12px').html('关闭');
}
})
})
</script>
</body>
</html>