velocity 的js里面循环对象使用#foreach
<script>
function changeSuggestionType(typeid){
var html="";
#foreach($types in ${myAccountDTO.suggestionIdeaCommand.types})
if(typeid==${types.suggestionType.suggestionTypeId}){
if("${types.typeSubDTOList}"=="[]"){
html+="<select style="width:200px"><option value="0">#springMessage("vm.myaccount.ideadeselect")</option></select>";
}else{
var index=false;
#foreach($typesubDTO in ${types.typeSubDTOList})
if(index)
html+="<select style="width:200px;margin-left:100px;" name="suggestionIdeaCommand.suggestionIdeaDTO.suggestionTypeSubId">";
else
html+="<select style="width:200px" name="suggestionIdeaCommand.suggestionIdeaDTO.suggestionTypeSubId">";
html+="<option value="0">#springMessage("vm.myaccount.ideadeselect")</option>";
#foreach($typesub in ${typesubDTO.suggestionTypeSubList})
html+="<option value="${typesub.suggestionTypeSubId}">${typesub.name}</option>";
#end
html+="</select><br><br>";
index=true;
#end
}
}
#end
document.getElementById("showtypesub").innerHTML = html;
}
</script>
function changeSuggestionType(typeid){
var html="";
#foreach($types in ${myAccountDTO.suggestionIdeaCommand.types})
if(typeid==${types.suggestionType.suggestionTypeId}){
if("${types.typeSubDTOList}"=="[]"){
html+="<select style="width:200px"><option value="0">#springMessage("vm.myaccount.ideadeselect")</option></select>";
}else{
var index=false;
#foreach($typesubDTO in ${types.typeSubDTOList})
if(index)
html+="<select style="width:200px;margin-left:100px;" name="suggestionIdeaCommand.suggestionIdeaDTO.suggestionTypeSubId">";
else
html+="<select style="width:200px" name="suggestionIdeaCommand.suggestionIdeaDTO.suggestionTypeSubId">";
html+="<option value="0">#springMessage("vm.myaccount.ideadeselect")</option>";
#foreach($typesub in ${typesubDTO.suggestionTypeSubList})
html+="<option value="${typesub.suggestionTypeSubId}">${typesub.name}</option>";
#end
html+="</select><br><br>";
index=true;
#end
}
}
#end
document.getElementById("showtypesub").innerHTML = html;
}
</script>
声明:该文观点仅代表作者本人,入门客AI创业平台信息发布平台仅提供信息存储空间服务,如有疑问请联系rumenke@qq.com。
- 上一篇:没有了
- 下一篇: velocity 中Map 和List 循环