0
Hello, I would like to know how I can do the following, I have several images with names, and created a script in js for me to type in the input and what I typed appear below, and this time I would like you to form an image. Example: I write the name "Andre". I wanted the command "img" (html), to have the "src" for the link of this image, for example, I would write the directory, and only come 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>
I couldn’t understand the question. Do you want to rename the image with what is typed? Or call the image that matches the typed one?
– flpms
Like, I type in the input the name "Andre" and it appears in the image directory as if the image name was Andre. If I write "Oberto" will appear the image of this Oberto. I could understand?
– Paulo Cavalcante