无法清除struts属性的值

时间:2017-07-03 10:58:18

标签: javascript struts-1

无法清除struts属性值。脚本错误 - "无法为样式设置值" null"

 <html:form name="form1">
 <html:password property="PASSWORD" styleId="Password"/>
 </html:form>

我的javascript代码如下

function clearValue(){
document.getElementById('Password').value="";
}

1 个答案:

答案 0 :(得分:0)

document.forms [0] = .password.value&#34;&#34 ;;

或类似的事情

tags = ele.getElementsByTagName('input');
 for(i = 0; i < tags.length; i++) {
switch(tags[i].type) {
    case 'password':
    case 'text':
        tags[i].value = '';
        break;
    case 'checkbox':
    case 'radio':
        tags[i].checked = false;
        break;
  }
 }

 tags = ele.getElementsByTagName('select');
  for(i = 0; i < tags.length; i++) {
  if(tags[i].type == 'select-one') {
     tags[i].selectedIndex = 0;
 }
else {
    for(j = 0; j < tags[i].options.length; j++) {
        tags[i].options[j].selected = false;
    }
}
   }

tags = ele.getElementsByTagName('textarea');
  for(i = 0; i < tags.length; i++) {
     tags[i].value = '';
}

然后我只需用按钮调用此功能,它就会清除所有内容。谢谢你的帮助。

相关问题