Wing Ck
2 min readMay 17, 2017

--

你好,我照著你的方法建立了一個表單供使用者上傳資料,
所有功能都正常,就是上傳失敗。以下是我覺得可能有問題的部分
=======================================<script type=”text/javascript”>

window.onload=function(){
var myCountry=document.getElementById(“myCountry”);
hidden(‘myCountry2’); // hide the keyin box when the program start
myCountry.onchange=doit;

var myIdentity=document.getElementById(“myIdentity”);
hidden(‘myIdentity2’); // hide the keyin box when the program start
myIdentity.onchange=doit;
} //這一行有 } 的話,不能 upload,可是 myCountry2 和 myIdentity2 會自動隱藏/顯示
// 沒有 } 的話,可以 upload,可是myCountry2 和 myIdentity2 不會自動隱藏/顯示

function $(obj){
return document.getElementById(obj);
}
function show(objid){
$(objid).style.display=’inline’;
}
function hidden(objid){
$(objid).style.display=’none’;
}

function doit(){
var myCountry_val=$(‘myCountry’).value;
var myIdentity_val=$(‘myIdentity’).value;

if(myCountry_val==’Others’)
show(‘myCountry2’);
else
hidden(‘myCountry2’);

if(myIdentity_val==’Others’)
show(‘myIdentity2’);
else
hidden(‘myIdentity2’);
}
</script>

--

--