zoukankan      html  css  js  c++  java
  • jsp页面

    一、播放声音

      1.页面中的处理:<div  id=”alm”></div>

      2.Js处理:

        function playVoice (value){

          //获取主机地址之后的目录

             var pathName = window.document.location.pathname;

             //获取带"/"的项目名,

             var projectName = pathName.substring(0,

               pathName.substr(1).indexOf('/') + 1);

             //拼接获取声音路径

             value = projectName + value;

             //将原来embed中的声音清空

             document.getElementById("alm").innerHTML = "";

             if (navigator.userAgent.indexOf("MSIE") != -1) {

                 //加入现在选择的声音

                 document.getElementById("alm").innerHTML = '<embed src="'+value+'" quality="high" '+

                    'width="0" height="0" autostart="true"  hidden="true" loop="true" ' +'type="application/x-ms-wmp">'

                    + '</embed>';

             } else {

                 //加入现在选择的声音

                 document.getElementById("alm").innerHTML = '<audio id="aaa" src="'+

            value+'" width="0" height="0" hidden="true" loop="loop" autoplay controls></audio>';

             }

        }

    二、get请求传递中文参数乱码: 

      1.在页面端对url进行编码:

        使用encodeURI(传递的参数值)如:”...?username=”+encodeURI(“中文参数”)

      2.在后台通过解码来接收改中文参数:

        String name=new String(request.getParameter(“username”).getBytes(“ISO-8859-1”),”UTF-8”);

  • 相关阅读:
    php内存管理机制与垃圾回收机制
    PHP Laravel5实现的RBAC权限管理操作示例
    PHP实现微信企业付款到个人零钱步骤
    ThinkPHP 6.0 管道模式与中间件的实现分析
    深入讲解 Laravel 的 IoC 服务容器
    ThinkPHP6 核心分析:系统服务
    PHP 性能优化
    PHP 7.4 新语法:箭头函数
    深入理解 PHP 的 7 个预定义接口
    Java实现 LeetCode 795 区间子数组个数 (暴力分析)
  • 原文地址:https://www.cnblogs.com/zijinyouyou/p/6495094.html
Copyright © 2011-2022 走看看