Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <body>
- <h2>My First JavaScript</h2>
- <div id="video" class="UJAwNkhbYWM"> </div>
- <div id="div"><img id="img"></div>
- <br>
- Enter Text To Play:
- <input id="text" value="">
- <br>
- <button class="btn btn-success" onclick="talk()">Atenas
- Falar!</button>
- <button type="button"
- onclick="document.getElementById('demo').innerHTML = Date()">
- Click me to display Date and Time.</button>
- <p id="demo"></p>
- <script>
- var nota = document.getElementById("text").value;
- function limparimg() { document.getElementById("div").innerHTML=""; }
- function limparvid() { document.getElementById("video").innerHTML=""; }
- function videoof(){
- var video = document.getElementById("video");
- var video_class = video.className;
- var iFrame = '<iframe id="caixa" allowfullscreen="" frameborder="0" height="200" width="250" src="https://www.youtube.com/embed/' + video_class + '"></iframe>';
- video.innerHTML = iFrame;
- }
- function mostracav(){
- var foto=new Array(10);
- foto[0]="<img src=http://www.ficasimples.com.br/eliza/cavit.jpg>";
- foto[1]="<img src=http://www.ficasimples.com.br/eliza/cavit1.jpg";
- foto[2]="<img src=http://www.ficasimples.com.br/eliza/cavit2.jpg>";
- foto[3]="<img src=http://www.ficasimples.com.br/eliza/cavit3.jpg>";
- foto[4]="<img src=http://www.ficasimples.com.br/eliza/cavit4.jpg>";
- foto[5]="<img src=http://www.ficasimples.com.br/eliza/cavit5.jpg>";
- foto[6]="<img src=http://www.ficasimples.com.br/eliza/cavit6.jpg>";
- foto[7]="<img src=http://www.ficasimples.com.br/eliza/cavit7.jpg>";
- foto[8]="<img src=http://www.ficasimples.com.br/eliza/cavit8.jpg>";
- foto[9]="<img src=http://www.ficasimples.com.br/eliza/cavit9.jpg>";
- foto[10]="<img src=http://www.ficasimples.com.br/eliza/cavit10.jpg>";
- num=0
- sorteia=Math.random(num)*6
- ok=Math.round(sorteia)
- document.getElementById("div").innerHTML = foto[ok];
- }
- function talk(){
- var nota = document.getElementById("text").value;
- var vid ="vid";
- var qya ="foto";
- if (nota == "vid") { limparimg(); videoof();}
- else if (nota == "foto" ) { limparvid(); mostracav();}
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement