In the HTML header section:
<script type="text/javascript" src="Scripts/editScripts.js"></script>
Just above the tag </body>(closing tag, at the bottom of the html page). Also: this is old code, and it was when it didn't work :
<script type="text/javascript">if(document.getElementById)initialize();loadEvents();</script>
</body>
</html>
In the editScripts.js file:
function loadEvents() {
var a = document.getElementById('addField');
a.onclick = addFileInput;
}
var upload_number = 2;
function addFileInput() {
var d = document.createElement("div");
var file = document.createElement("input");
file.setAttribute("type", "file");
file.setAttribute("name", "addFile[]");
file.setAttribute("size", "35");
file.setAttribute("class", "file");
file.setAttribute("id", "addFile"+upload_number);
d.appendChild(file);
document.getElementById("moreUploads").appendChild(d);
upload_number++;
}
This will not work. I am replacing javascript in the footer with this.
This is new code that works as I expect. :
<script type="text/javascript">if (document.getElementById)loadEvents();</script>
And now it will work ... I don’t see how refusing to call this function, even if it is the function that it referred to, does not exist, will randomly get confused.
source
share