无法访问javascript中的隐藏字段值

时间:2014-10-28 10:57:23

标签: javascript html jsp struts

JSP:

<input type='hidden' 
       id='<bean:write name="academicGoalLevel" property="contentId1" />' 
       name='<bean:write name="academicGoalLevel" property="contentId1" />'
       value='<bean:write name="academicGoalLevel" property="activity1" />' 
  />

JavaScript的:

// id is 30 only
var x = document.getElementById('30').value;
alert(x);
if (x.length != 0) {
    alert("Please Enter a School Year 1");
    return false;
}

我第一次访问该页面并在文本字段中输入数据时,我无法获得JavaScript中的值。

当我第二次来到隐藏的田地时。

我该如何解决这个问题?

0 个答案:

没有答案