• 前端


    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>
    坚持就是胜利
  • 相关阅读:
    dedecmsV5.7和discuz!X3.4整合之后免激活登陆
    dedecms织梦文章微信分享带缩略图与简介
    关于PHP的mkdir函数
    关于discuz的fap.php 漏洞问题
    discuzX3.4安装之后,没有任何样式怎么办?
    阿里云 RDS for MySQL支持什么引擎
    PHP随机生成要求位数个字符(大小写字母+数字)
    PHP json_decode为什么将json字符串转成数组是对象格式?
    PHP实用的功能函数
    css实现三角形图标
  • 原文地址:https://www.cnblogs.com/xiaotieblog/p/8510614.html
Copyright © 2020-2023  润新知