zoukankan      html  css  js  c++  java
  • 兼容chrome和ie的音乐播放

    兼容chrome和ie的音乐播放(Ie7 Ie8 Ie9 均測试过 )

    <!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" />
    <title>aa</title>
    
    
    <script> 
    function playSound(){ 
    	var snd_ie = document.getElementById('snd_ie'); 
    	snd_ie.src = "./alert.wav"
    
    
    	var snd_chrome = document.getElementById('snd_chrome'); 
    	snd_chrome.data = "./alert.wav"
    } 
    function stopSound(){ 
    	var snd_ie = document.getElementById('snd_ie'); 
    	snd_ie.src = ""
    
    
    	var snd_chrome = document.getElementById('snd_chrome'); 
    	snd_chrome.data = ""
    } 
    
    
    </script> 
    
    
    </head>
    <body>
    	<bgsound id='snd_ie' src="" loop=-1></loop>
    	<object id='snd_chrome' width="0px" height="0px" type="audio/x-wav" data=""></object>
    	<input type="button" value="開始" onclick="playSound()"> 
    	<input type="button" value="暂停" onclick="stopSound()"> 
    </body>
    </html>
    






  • 相关阅读:
    设计模式来替代if-else
    Cloneable接口的作用与深度克隆与浅度克隆
    IP地址分类
    MIME-TYPE
    Linux curl
    Cookie 跨域???
    冒烟测试
    @Valid、@Validated 、正则验证工具
    Node.js—第一个动态页面
    Node.js—小试牛刀-创建目录
  • 原文地址:https://www.cnblogs.com/blfbuaa/p/7098297.html
Copyright © 2011-2022 走看看