Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <iframe id="iframeBlock" width="250" height="115" src="" class="hides" frameborder="0" allowfullscreen></iframe>
- <input type="radio" name="video" id="example1" onclick="buka()"><label for="video">Video 1</label><br>
- <input type="radio" name="video" id="example2" onclick="buka()"><label for="video">Video 2</label>
- <hr>
- <button type="button" id="play" onclick="playvideoBlock()">Play</button>
- <button type="button" id="close" onclick="closevideoBlock()">Close</button>
- <style>
- label {
- display: inline-block;
- margin-left: 5px;
- }
- .shows {
- display: block;
- }
- .hides {
- display: none;
- }
- </style>
- <script type="text/javascript">
- function playvideoBlock() {
- var ex1 = document.getElementById("example1").checked;
- var ex2 = document.getElementById("example2").checked;
- if(ex1 === true) {
- document.getElementById("iframeBlock").setAttribute("src", "https://www.youtube.com/embed/TRJkxG2GTjw");
- document.getElementById("iframeBlock").setAttribute("class", "show");
- }
- if(ex2 === true) {
- document.getElementById("iframeBlock").setAttribute("src", "https://www.youtube.com/embed/9uKVI6_Fm4g");
- document.getElementById("iframeBlock").setAttribute("class", "show");
- }
- }
- function closevideoBlock() {
- var ex1 = document.getElementById("example1").checked;
- var ex2 = document.getElementById("example2").checked;
- if(ex1 === true) {
- document.getElementById("iframeBlock").setAttribute("class", "hides");
- }
- if(ex2 === true) {
- document.getElementById("iframeBlock").setAttribute("class", "hides");
- }
- }
- </script>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement