您的位置:首页 > Web前端 > JavaScript

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>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  js
相关文章推荐