zoukankan      html  css  js  c++  java
  • rt_dream01

    10.15
    当出入金值发生变化时给全局添加声音
    cs界面
    //在数据库中取出最后一个出入金的值
    public partial class api_info_check_new_cashrecord : System.Web.UI.Page
    {
    protected void Page_Load(object sender, EventArgs e)
    {
    Ari.Fi.CashRecord[] rows = Ari.Fi.CashRecord.LoadAll("TOP 1", "ORDER BY ID DESC");

    if (rows.Length > 0)
    {
    top_cashrecord_id = rows[0].ID;
    }
    }
    }
    aspx界面
    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="check-new-cashrecord.aspx.cs" Inherits="api_info_check_new_cashrecord" %>
    <%= top_cashrecord_id %>
    //查看最后一个出入金id是否变换,如果改变了就发出声音
    + <audio src="/ui/4082.wav" preload id="new-cashrecord-alert"></audio>

    <% if (Ari.Sys.StaffRole.CheckPoint(this.sessionuser, Protocol.Auth.Privilege.Enums.Fi_Cash_WithdrawApprove)) { %>
    setInterval(function () {
    $.get('/api/info/check-new-cashrecord', function (data) {
    + var top_cashrecord_id = data.trim();
    + var local_id = localStorage.getItem("top_cashrecord_id");
    +
    + if (!local_id)//false,local_id为string,加“!”后变为false
    + localStorage.setItem("top_cashrecord_id", top_cashrecord_id);
    + else
    + if (local_id != top_cashrecord_id){
    + $('#new-cashrecord-alert')[0].play();
    + localStorage.setItem("top_cashrecord_id", top_cashrecord_id);
    + }
    });
    }, 5000);
    <% } %>
    1
    localStorage.setItem("top_cashrecord_id", top_cashrecord_id)//设置top_cashrecord_id的值
    localStorage.getItem("top_cashrecord_id")//获取top_cashrecord_id的值
    以键值对的方式存储,存储的类型为string类型
    2
    localStorage - 没有时间限制的数据存储
    sessionStorage - 针对一个 session 的数据存储

  • 相关阅读:
    日期类型存储方法
    Log4j2的一些记录
    【Maven】学习记录
    HTML 图片加载问题
    浏览器的组成
    javascript数组的实例属性(方法)
    javascript数组的内置对象Array
    javascript之this
    css的position,float属性的理解
    简单介绍帧动画
  • 原文地址:https://www.cnblogs.com/lv-sally/p/4894527.html
Copyright © 2011-2022 走看看