1
I need help in the lines below where video and image appear when I type photo
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 = video.className;
var iFrame = document.getElementById("caixa");
iFrame.src = "https://www.youtube.com/embed/" + video;
}
function mostracav() {
var foto = "<img src=http://www.ficasimples.com.br/eliza/cavit.jpg>";
new Array(10);
document.getElementById("div").innerHTML = foto;
}
function talk() {
var nota = document.getElementById("text").value;
var vid = "vid";
if (nota == "vid") {
videoof();
}
var qya = "foto";
if (nota == "foto") {
mostracav();
}
}
<h2>My First JavaScript</h2>
<div id="video" class="UJAwNkhbYWM"><iframe id="caixa" allowfullscreen="" frameborder="0" height="200" width="250"></iframe> </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>
You can check why the video and image appears when I type photo.
This loose array makes no sense
var foto="<img src=http://www.ficasimples.com.br/eliza/cavit.jpg>";new Array(10);
, I tested here and only appeared the photo, iframe was not updated, must be getting confused.– Guilherme Nascimento
Hello Silezia! I put an answer, but I don’t know if I really understand what you asked - if you can, please clarify your intention better editing the question.
– Daniel