I'm trying to use the onchange
function, until I get the value, but I can not make use of the value,
Select and script:
<select id="mySelect" onchange="myFunction()">
<option value="1">1 Questão
<option value="2">2 Questões
<option value="3">3 Questões
<option value="4">4 Questões
</select>
</div>
<b id="demo"></b> //aqui eu imprimo o valor de x corretamente
<script>
function myFunction() {
var x = document.getElementById("mySelect").value;
document.getElementById("demo").innerHTML = x;
}
</script>
I would like to use the value of X
as a complement to the image address
I tried this way:
<img src="img/gab<?echo '<b id="demo"></b>'?>.png" />
So
<img src="img/gab<script>x</script>.png" />
and
<img src="img/gab<script>$x</script>.png" />
I do not know how to do it