我在HTML文件中的函數不能正常工作,但我寫了更高的錯誤。當我從
funtion名(...),以window.name =功能(...)更改它
但它不工作,無論如何,寫
「write.name不finction」 我的代碼
爲什麼沒有定義函數javascript
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript">
function changeText(id) {
id.innerHTML = "Ooops!";
}
function displayDate() {
document.getElementById("demo").innerHTML = Date();
}
function addField() {
document.getElementById("demo").innerHTML = Date();
}
function addInput(divName){
var newdiv = document.createElement('div');
newdiv.innerHTML = "<br>Select File to Upload:<br><input type="file" onchange="addInput('dynamicInput');" name="fileName">";
document.getElementById(divName).appendChild(newdiv);
window.displayDate();
window.addField();
}
</script>
</head>
<body>
<h1 id="fff" onclick="changeText(this);">Click on this text!</h1>
<form action="/getimage" method="post" enctype="multipart/form-data">
<div id="dynamicInput">
<br>Select File to Upload:<br><input type="file" onchange="addInput('dynamicInput');" name="fileName">
</div>
<input type="submit" value="Upload">
<input type="button" value="Add another input" onClick="addInput('dynamicInput');">
</form>
<p id="demo"></p>
</body>
請幫忙!
你能分享你所得到的確切的錯誤信息? – Luca
''write.name不是finction「'?真? – melpomene
您在''
選擇要上傳的文件:
melpomene