日期:2014-05-16 浏览次数:20349 次
var selected = ${requestScope.xxxxForm.recordNumPerPage},这样始终js错误,因为在第一次的时候requestScope.xxxxForm.recordNumPerPage为null。于是在boss的指导下,简单的加了两个引号,代码变成
"]var selected = “${requestScope.xxxxForm.recordNumPerPage}”,ok,功能自动实现。
function getSelected(name){ var selects = document.getElementsByName(name); var selected = “${requestScope.xxxxForm.recordNumPerPage}"; if(selected == undefined || selected == null || selected ==""){ return false; } for(var j = 0; j < selects.length; j++ ){ for(var i = 0; i = selects[j].length; i++){ if(selects[j].options[i].value == selected){ selects[j].options[i].selectd = true; } } } }