Home > Backend Development > PHP Tutorial > jquery 异步有道翻译API的声音路径 如何加载到 audio src?

jquery 异步有道翻译API的声音路径 如何加载到 audio src?

WBOY
Release: 2016-06-06 20:33:21
Original
1130 people have browsed it

jquery 异步有道翻译API的声音路径 如何加载到 audio src?

回复内容:

jquery 异步有道翻译API的声音路径 如何加载到 audio src?

加载到 audiojQuery 其实并没有多大关系..

<code> <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script> 
 <audio id="hello" autoplay="true" controls="controls"></audio>


<script type="text/javascript">
    var audio = document.getElementById('hello');

    audio.src = 'http://dict.youdao.com/dictvoice?audio=hello&type=1';

    setTimeout(function(){
        $('#hello').attr('src', 'http://dict.youdao.com/dictvoice?audio=world&type=1');
    }, 3000);
  </script>



</code>
Copy after login

预览地址: http://jsbin.com/jolunuxiho/1/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template