入门客AI创业平台(我带你入门,你带我飞行)
博文笔记

velocity 的js里面循环对象使用#foreach

创建时间:2015-03-10 投稿人: 浏览次数:7882
<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。