velocity 的js里面循环对象使用#foreach
2015-03-10 11:29
961 查看
<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>
相关文章推荐
- 使用了iframe框架,而且iframe里面嵌套的frame框架 ,弹出框出现zDialog.js中的“topWin.Dialog._Array为空或不是对象”。(开发笔记3)
- js入门·循环与判断/利用函数的简单实例/使用对象/列举对象属性的名称
- mongo里面根据对象字段的ID查询 db.Photo.find({'owner.$id':ObjectId('xxxx')}) , 并且使用forEach循环修改查询的数据
- java性能优化之二 循环里面不使用hibernate创建对象
- js入门·循环与判断/利用函数的简单实例/使用对象/列举对象属性的名称
- 在jsp的c标签循环后台对象属性的情况下,使用js提取其中一个id属性使用ajax传到后台删除
- Android 调用js,传对象到js里面使用addJavascriptInterface错误总结
- js入门·循环与判断/利用函数的简单实例/使用对象/列举对象属性的名称
- 在jsp的c标签循环后台对象属性的情况下,使用js提取其中一个id属性使用ajax传到后台删除
- 请教asp.net 中使用js 引用 document window对象的疑问
- JS FileSystemObject 对象使用
- js使用对象直接量创建对象的代码
- 在js中使用createElement创建HTML对象和元素
- 使用for...in进行对象循环
- 在ascx中使用js找不到对象问题解决
- JS中如何声明和使用对象
- Dom元素+闭包+循环调用+js移除对象+IE6/7 --> 内存泄漏
- 在js的对象中使用setTimeout和setInterval调用对象自身方法
- 循环与判断/利用函数的简单实例/使用对象/列举对象属性