I'm using this javascript function to use a form to insert text into a set div.
I would like to be able to put an image url into a form and use this function to insert the url into an img tag instead of a div. What way could I achieve this?
Javascript:
function header01(){
var head01v = document.getElementById('head01i').value;
document.getElementById('head01c').innerHTML = head01v;
document.getElementById('head01c').style.display = "block";
return false;
}
I attempted to use the suggested solution, inputting the appropriate fields
function image01(){
var img = document.createElement('img');
img.src = document.getElementById('imag01i').value;
document.getElementById('imag01c').appendChild(img);
return false;
}
But to no avail, any additional help is greatly received.
var img = document.createElement('img'); img.src = theValueOfTheForm;Could that be of help?