复制代码代码如下:
// 清空 Formulário 选择
function clearform (id) {
var formObj = document.getElementById (id);
if (formObj == indefinido) {
retornar;
}
for (var i = 0; i <formObj.elements.length; i ++) {
if (formObj.Elements [i] .Type == "text") {
formObj.Elements [i] .Value = "";
}
caso contrário, if (formObj.Elements [i] .Type == "senha") {
formObj.Elements [i] .Value = "";
}
caso contrário, if (formObj.Elements [i] .Type == "Radio") {
formObj.Elements [i] .CHecked = false;
}
caso contrário, if (formObj.Elements [i] .Type == "Caixa de seleção") {
formObj.Elements [i] .CHecked = false;
}
caso contrário, if (formObj.Elements [i] .Type == "select-one") {
formObj.Elements [i] .Options [0] .Selected = true;
}
caso contrário, if (formObj.Elements [i] .Type == "select-multiple") {
for (var j = 0; j <formObj.Elements [i] .options.length; j ++) {
formObj.Elements [i] .Options [j] .Selected = false;
}
}
caso contrário, if (formObj.Elements [i] .Type == "arquivo") {
//FormobJ.Elements [i] .Select ();
//document.selection.clear ();
// para IE, ópera, safari, Chrome
var arquivo = formObj.Elements [i];
if (file.outerhtml) {
file.outerhtml = file.outerhtml;
}outro{
file.value = ""; // ff (包括 3,5)
}
}
caso contrário, if (formObj.Elements [i] .Type == "textarea") {
formObj.Elements [i] .Value = "";
}
}
}