I have this div called “frame” which acts as a container where I’m drawing some gifs
[CODE]
<center>
<div id=”frame”>
<form name = “inserimento” action=”” method=”POST”>
numero:<input type = “text” name = “input” value = “” size=”2″>
<input type = “submit” name =”pulsante” id = “nodo” value = “inserisci” onclick = “insert();”>
</form>
<script language = “javascript”>
//draw(); decomment to draw
</script>
</div>
</center>
</body>
The drawing is done by the function draw.
[CODE]
function draw(){
var newdiv = document.createElement(‘div’);
var divIdName = ‘prova’ + div_id;
div_id += 1;
newdiv.setAttribute(‘id’,divIdName);
newdiv.style.position = ‘absolute’;
newdiv.innerHTML = ‘<img src=”1.gif”>’;
newdiv.style.left = 0;
newdiv.style.top = 0;
document.getElementById(‘frame’).appendChild(newdiv);
}
If I decomment the function draw everything is fine, with the gif being displayed. I want to do the same thing upon clicking the button pulsante by means of the event handler [I]insert
[CODE]
<form name = “inserimento” action=”” method=”POST”>
numero:<input type = “text” name = “input” value = “” size=”2″>
<input type = “submit” name =”pulsante” id = “nodo” value = “inserisci” onclick = “insert();”>
</form>
This handler is as follows
[CODE]
function insert(){
draw();
}
The problem is that nothing is drawn when calling the function insert. Why ??? ?