Hello, I would like to know how I can do the following, I have several images with names, and I created a script in js for me to type in the input and what I typed appears underneath, and this time I would like you to create an image. Example: I write the name "andre". I wanted the "img" (html) command to be left with the "src" link for this image, for example, I would already write the directory, and only came in the name "andre" in the middle.
Ex:
My script with input:
<script type="text/javascript">
window.mostrarTexto= function(valor){
var campo = document.getElementById("campo").value;
div.innerHTML = campo;
}
</script>
HTML:
<input id="campo" type="text" onkeyup="mostrarTexto(this.value)"/>
<div id="div" style="display:block"></div>