zoukankan      html  css  js  c++  java
  • 前端

    1、下拉列表选择生效函数

      

    function changeSessionMarketType(marketType) {
            var params = {marketType:marketType}
            
            $.ajax({
                 type: "POST",
                  url: "./adminHome/changeSessionMarketType.html",
                  data: params,
                  success: function(msg){
                    window.location.reload();
                    alert("切换成功!");
                   }
            });
        }
        
        function changeSessionLanguageType(languageType) {
            var currentUrl = window.location.href;
            if(0 == languageType){
                window.location.href = "./adminHome/main.html?lang=zh_CN";
    /*             if(currentUrl.indexOf("?") != -1){
                    window.location.href = currentUrl + "&lang=zh_CN";
                }else{
                    window.location.href = currentUrl + "?lang=zh_CN";
                } */
            }else if(1 == languageType){
                window.location.href = "./adminHome/main.html?lang=en_US";
    /*             if(currentUrl.indexOf("?") != -1){
                    window.location.href = currentUrl + "&lang=en_US";
                }else{
                    window.location.href = currentUrl + "?lang=en_US";
                } */
            }
        }
    <%
        String role = (String)request.getSession().getAttribute("ROLE");//当前登录用户的权限
        Locale locale = (Locale)request.getSession().getAttribute("LOCALE");//当前登录用户的语言
        Integer marketType = (Integer)request.getSession().getAttribute("marketType");//当前登录用户的APP
        RequestContext requestContext = new RequestContext(request);  
        Locale myLocale = requestContext.getLocale(); 
        String language = myLocale.getLanguage();
    %>
    <div class="account_meta account_language">
                        <spring:message code="language" />:
                        <select id="languageType"
                            onchange="changeSessionLanguageType(this.options[this.options.selectedIndex].value)">
                            <option value="0" <%if(language.contains("zh")){%> selected<% } %>>
                                <spring:message code="language.cn" />
                            </option>
                            <option value="1" <%if(language.contains("en")){%> selected<% } %>>
                                <spring:message code="language.en" />
                            </option>
                        </select>
                        <!-- Locale: ${pageContext.response.locale} -->
                    </div>
                    
                    <div class="account_meta account_language">
                        <spring:message code="switch_app" />: 
                        <select id="marketType"
                            onchange="changeSessionMarketType(this.options[this.options.selectedIndex].value)">
                            <option value="0" <%if(marketType.intValue()==0){%> selected<% } %>>FCA</option>
                            <option value="1" <%if(marketType.intValue()==1){%> selected<% } %>>SCB</option>
                        </select>
                    </div>
    坚持就是胜利
  • 相关阅读:
    js插件ztree使用
    asp.net错误页和asp.net mvc错误页设置
    C#实现Excel的导入导出
    ios开发UI篇—使用纯代码自定义UItableviewcell实现一个简单的微博界面布局
    iOS开发UI篇—UITabBarController简单介绍
    iOS开发UI篇—字典转模型
    iOS开发UI篇—从代码的逐步优化看MVC
    iOS开发UI篇—九宫格坐标计算
    iOS开发UI篇—transframe属性(形变)
    iOS开发UI篇—懒加载
  • 原文地址:https://www.cnblogs.com/xiaotieblog/p/8510614.html
Copyright © 2011-2022 走看看