为啥?
js如下:
function removefiles(){
document.getElementById("t_files").innerHTML="<input type='hidden' name='tmpf' value='0'><input type='file' name='tmpfile' class='dzrz_input1' style='width:180px;' UNSELECTABLE ='on' onchange=\"document.getElementById('t_files').firstChild.value=1;\"><br><input type='button' class='dzrz_button1' value='清除附件' onclick='dzrzmb_removefiles();' style='width:180px;text-align:center;'>"
}
html如下:
<span id="t_files"><input type="hidden" name="tmpf" value="0"><input type="file" name="tmpfile" class="dzrz_input1" style="width:180px;" UNSELECTABLE ="on" onchange="document.getElementById('t_files').firstChild.value=1;"><br><input type="button" class="dzrz_button1" value="清除附件" onclick="removefiles();" style="width:180px;text-align:center;"></span>功能:页面里有个上传附件的输入框,有一个清除附件的按钮,一按清除附件按钮,会自动将id内的html代码重写一遍只要删除掉js里的onchange=\"document.getElementById('t_files').firstChild.value=1;\" 这一段就可以运行,但就没法实现一些功能了
js如下:
function removefiles(){
document.getElementById("t_files").innerHTML="<input type='hidden' name='tmpf' value='0'><input type='file' name='tmpfile' class='dzrz_input1' style='width:180px;' UNSELECTABLE ='on' onchange=\"document.getElementById('t_files').firstChild.value=1;\"><br><input type='button' class='dzrz_button1' value='清除附件' onclick='dzrzmb_removefiles();' style='width:180px;text-align:center;'>"
}
html如下:
<span id="t_files"><input type="hidden" name="tmpf" value="0"><input type="file" name="tmpfile" class="dzrz_input1" style="width:180px;" UNSELECTABLE ="on" onchange="document.getElementById('t_files').firstChild.value=1;"><br><input type="button" class="dzrz_button1" value="清除附件" onclick="removefiles();" style="width:180px;text-align:center;"></span>功能:页面里有个上传附件的输入框,有一个清除附件的按钮,一按清除附件按钮,会自动将id内的html代码重写一遍只要删除掉js里的onchange=\"document.getElementById('t_files').firstChild.value=1;\" 这一段就可以运行,但就没法实现一些功能了
document.getElementById("t_files").innerHTML="<input type='hidden' name='tmpf' value='0'><input type='file' name='tmpfile' class='dzrz_input1' style='width:180px;' UNSELECTABLE ='on' onchange=\"document.getElementById('t_files').firstChild.value=1;\"><br><input type='button' class='dzrz_button1' value='清除附件' onclick='removefiles();' style='width:180px;text-align:center;'>"
}