简体   繁体   中英

Audio controls won't show when button is clicked JavaScript

I have a problem, I am implimenting JavaScript into my website to show the audio controls when the button is clicked. I have the controls hidden with CSS and I need JavaScript to show the controls when my button is clicked. Here is my code.

<video id="videoBackground" poster="img/loading.gif" onload="function()" width="1920" height="1080" preload="auto" onprogress="animCD_onprogress();" onended="animCD_start();">
    <source id="colorVid_mp4" type="video/mp4" src="img/luther_color.mp4">      
</video>

    <audio id="audioInterview" preload='auto' controls>
        <source src="audio/interview.mp3" type="audio/mpeg">
    </audio>


<div class="buttonSkip" onclick="window.location='http://www.lrltv.org/muslims-nuclear.html'"></div>

<div id="buttonPlacement" class="buttonPlacement">
    <div onclick="showAudio('audioInterview')"; class="btnDonate"></div>
    <div onclick="alert('Clicked Buy');" class="btnBuy"></div>  
</div>

<!-- Show Audio when button is clicked -->

<script>
    function showAudio('audioInterview')
    {
        var obj=document.getElementById('audioInterview');
        obj.className = 'show';
    }
</script>
function showAudio('audioInterview')
{
    var obj=document.getElementById('audioInterview');
    obj.className = 'show';
}

is wrong, it should be

 function showAudio(controlId)
    {
        var obj=document.getElementById(controlId);
        obj.className = 'show';
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM