Hallo,
//inp.onchange = 'showImage(filecount);'; // das geht nicht
Doch, das geht, außer im IE.
inp.onchange = function() {showImage(filecount);};
Das geht überall.
<html>
<head>
<title>MultiUpload</title>
<script type="text/javascript">
<!--
function showImage(imgNr)
{
alert(imgNr);
}
var filecount = 0;
function insert_file_input(tbody_id)
{
var fx = document.getElementById(tbody_id);
var tr = document.createElement("tr");
var td = document.createElement("td");
var inp = document.createElement("input");
inp.size = 60;
inp.maxlength = 80;
inp.type = 'file';
inp.name = 'file[]'
inp.id = 'fileId' + filecount;
//inp.onchange = 'showImage(filecount);';
inp.onchange = function() {showImage(filecount);};
td.appendChild(inp);
tr.appendChild(td);
fx.appendChild(tr);
filecount++;
}
//-->
</script>
</head>
<body onLoad="insert_file_input('tb1');">
<form name="form2" id="f2" action="http://testserver.lan.fli4l/~thomas/test/debug/kontrolle.php"
method="post"
enctype="multipart/form-data"
onChange="document.getElementById('btn01').visible = true;">
<table id="t1">
<thead></thead>
<tbody id='tb1'></tbody>
<tfoot></tfoot>
</table>
</form>
</body>
</html>
viele Grüße
Axel
PS:
Die Funktion heißt anonymous, weil sie keinen Namen hat ;-))