当前位置:编程学习 > C#/ASP.NET >>

js实现提示窗口,获取Label中的数据----在线急等待----【有图gif-源码aspx-项目rar】



目前已经实现,屏幕左下角判断label数据,点击button事件才能进行判断【值的大小】大于0就进行提示
判断条件:label中的值大于0就提示。

我希望进行改进成网页启动后,代码不需要基于button事件,label中的值是后台绑定1分钟更新一次;
通过javascript获取Label控件中的值,
判断值>0就提示屏幕左下角提示...判断值=0 或空值则不提示
我写的这个是报警系统,有模板页;

代码已经拿出来了,效果图片也有,项目也有rar;



我对javascript属于是很迷茫的状态,并不是熟悉编码所以如果不能提供完整代码,只是谈谈思路就免了,我也不会采纳。


当前项目代码下载地址
或者复制地址IE回车:http://www.vdisk.cn/down/index/10327660
因为javascript屏幕左下角 需要图片效果 建议下载项目,完整aspx源码 

完整源码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javascript.aspx.cs" Inherits="javascript右下角信息提醒框.javascript" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        *
        {
            padding: 0;
            margin: 0;
        }
        li
        {
            list-style: none;
        }
        body
        {
            background: #eee;
        }
        .float_layer
        {
            width: 300px;
            border: 1px solid #aaaaaa;
            display: none;
            background: #fff;
        }
        .float_layer h2
        {
            height: 25px;
            line-height: 25px;
            padding-left: 10px;
            font-size: 14px;
            color: #333;
            background: url(title_bg.gif) repeat-x;
            border-bottom: 1px solid #aaaaaa;
            position: relative;
        }
        .float_layer .min
        {
            width: 21px;
            height: 20px;
            background: url(min.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .min:hover
        {
            background: url(min.gif) no-repeat 0 0;
        }
        .float_layer .max
        {
            width: 21px;
            height: 20px;
            background: url(max.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .max:hover
        {
            background: url(max.gif) no-repeat 0 0;
        }
        .float_layer .close
        {
            width: 21px;
            height: 20px;
            background: url(close.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 3px;
        }
        .float_layer .close:hover
        {
            background: url(close.gif) no-repeat 0 0;
        }
        .float_layer .content
        {
            height: 120px;
            overflow: hidden;
            font-size: 14px;
            line-height: 18px;
            color: #666;
            text-indent: 28px;
        }
        .float_layer .wrap
        {
            padding: 10px;
        }
        .style1
        {
            color: #0000FF;
        }
    </style>
    <script type="text/javascript">
        function miaovAddEvent(oEle, sEventName, fnHandler) {
            if (oEle.attachEvent) {
                oEle.attachEvent('on' + sEventName, fnHandler);
            }
            else {
                oEle.addEventListener(sEventName, fnHandler, false);
            }
        }

        function load() {
            var oDiv = document.getElementById('miaov_float_layer');
            var oBtnMin = document.getElementById('btn_min');
            var oBtnClose = document.getElementById('btn_close');
            var oDivContent = oDiv.getElementsByTagName('div')[0];

            oDiv.style.display = 'block';

            var iMaxHeight = 0;

            var isIE6 = window.navigator.userAgent.match(/MSIE 6/ig) && !window.navigator.userAgent.match(/MSIE 7|8/ig);

            iMaxHeight = oDivContent.offsetHeight;

            if (isIE6) {
                oDiv.style.position = 'absolute';
                repositionAbsolute();
                miaovAddEvent(window, 'scroll', repositionAbsolute);
                miaovAddEvent(window, 'resize', repositionAbsolute);
            }
            else {
                oDiv.style.position = 'fixed';
                repositionFixed();
                miaovAddEvent(window, 'resize', repositionFixed);
            }

            oBtnMin.timer = null;
            oBtnMin.isMax = true;
            oBtnMin.onclick = function () {
                startMove(
                    oDivContent,
                    (this.isMax = !this.isMax) ? iMaxHeight : 0,
                    function () {
                        oBtnMin.className = oBtnMin.className == 'min' ? 'max' : 'min';
                    }
                );
            };

            oBtnClose.onclick = function () {
                oDiv.style.display = 'none';
            };

            oDiv.style.display = 'none';
        }

        function startMove(obj, iTarget, fnCallBackEnd) {
            if (obj.timer) {
                clearInterval(obj.timer);
            }
            obj.timer = setInterval(
                function () {
                    doMove(obj, iTarget, fnCallBackEnd);
                },
                30
            );
        }

        function doMove(obj, iTarget, fnCallBackEnd) {
            var iSpeed = (iTarget - obj.offsetHeight) / 8;

            if (obj.offsetHeight == iTarget) {
                clearInterval(obj.timer);
                obj.timer = null;
                if (fnCallBackEnd) {
                    fnCallBackEnd();
                }
            }
            else {
                iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
                obj.style.height = obj.offsetHeight + iSpeed + 'px';

                ((window.navigator.userAgent.match(/MSIE 6/ig) && window.navigator.userAgent.match(/MSIE 6/ig).length == 2) ? repositionAbsolute : repositionFixed)()
            }
        }

        function repositionAbsolute() {
            var oDiv = document.getElementById('miaov_float_layer');
            var left = document.body.scrollLeft || document.documentElement.scrollLeft;
            var top = document.body.scrollTop || document.documentElement.scrollTop;
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = left + width - oDiv.offsetWidth + 'px';
            oDiv.style.top = top + height - oDiv.offsetHeight + 'px';
        }

        function repositionFixed() {
            var oDiv = document.getElementById('miaov_float_layer');
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = width - oDiv.offsetWidth + 'px';
            oDiv.style.top = height - oDiv.offsetHeight + 'px';
        }

        function Do() {
            var text = document.getElementById("TextBox1").value;
            if (parseInt(text) > 0) {
                document.getElementById("Label1").innerHTML = text;
                document.getElementById("number").innerHTML = text;
                document.getElementById("miaov_float_layer").style.display = "block";
            }
            else {
                document.getElementById("miaov_float_layer").style.display = "none";
            }
        }
    </script>
</head>
<body onload="load()">
    <form id="form1" runat="server">
    <div class="float_layer" id="miaov_float_layer">
        <h2>
            <strong>时时数据报警提示</strong> <a id="btn_min" href="javascript:;" class="min"></a><a
                id="btn_close" href="javascript:;" class="close"></a>
        </h2>
        <div class="content">
            <div class="wrap">
                <a href="www.baidu.com">当前在线报警数量<strong><span id="number">数量</span></strong>请尽快处</a>
                <%--<address><span class="MarginLeft10 a">游梁泵数据监测<a href="TWDataMonitorForm.aspx"></a>√</span></address>--%>
            </div>
        </div>
    </div>
    报警数量【<asp:Label ID="Label1" runat="server" BackColor="Red"></asp:Label>
    】<span class="style1">报警数量大于0就进行js提示</span><br />
    报警值填写<asp:TextBox ID="TextBox1" runat="server" ForeColor="Red" Width="69px"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Height="24px" OnClick="Button1_Click" OnClientClick="Do(); return false;" Text="设置报警数量"
        Width="100px" />
    <br />
    <br />
    <br />
    <br />

<div style="width:732px; height:200px; background-color:Black; color:Green;">
    <strong style="font-size:large;">
    需要实现的功能不基于Button事件;
    <br />
    <br />自行判断,提示窗口;
    <br />
    <br />
    前提...我用模板页了 所以希望您能帮我解决这个问题
     
    <br />
    <br />
    代码上如何改动 写上注释谢谢! 请各位大牛帮忙
    </strong></div>
    </form>
</body>
</html>





--------------------编程问答-------------------- 我说看ID肿么那么眼熟- = --------------------编程问答-------------------- 你后台数据变的时候是只刷新lable还是整个页面都刷新呢。
如果都刷新的话可以直接吧原先按钮onclick调用的方法放到body的onload事件里去
<body onload="function"></body>
如果是只刷新lable的话,可以使用setInterval(function, 60000); --------------------编程问答-------------------- 那你就写一个函数


functiont GoGo()
{
  var i='获取值';
  if(i>0){
    alert(‘测试’);
    SetTimeOut("GoGo",1000);
  }
}
GoGo(); --------------------编程问答--------------------
引用 1 楼  的回复:
我说看ID肿么那么眼熟- =


哈哈 是啊,主要是我用目标没有body...除非是在模板页面上写
但是那样貌似不好,有没有什么办法能直接判断 完整点的代码吧 
。,,javascript 我太烂了 分数不够我在追加 求详细 --------------------编程问答-------------------- 你修改一下源代码把 或者新建 一个页面 里面导入一个lable 有模板页的网站,项目

给我展示一下效果

我的项目中 是局部刷新的只有 lable刷新 

麻烦您了! --------------------编程问答--------------------

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Index" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <style type="text/css">
        *
        {
            padding: 0;
            margin: 0;
        }
        li
        {
            list-style: none;
        }
        body
        {
            background: #eee;
        }
        .float_layer
        {
            width: 300px;
            border: 1px solid #aaaaaa;
            display: none;
            background: #fff;
        }
        .float_layer h2
        {
            height: 25px;
            line-height: 25px;
            padding-left: 10px;
            font-size: 14px;
            color: #333;
            background: url(title_bg.gif) repeat-x;
            border-bottom: 1px solid #aaaaaa;
            position: relative;
        }
        .float_layer .min
        {
            width: 21px;
            height: 20px;
            background: url(min.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .min:hover
        {
            background: url(min.gif) no-repeat 0 0;
        }
        .float_layer .max
        {
            width: 21px;
            height: 20px;
            background: url(max.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .max:hover
        {
            background: url(max.gif) no-repeat 0 0;
        }
        .float_layer .close
        {
            width: 21px;
            height: 20px;
            background: url(close.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 3px;
        }
        .float_layer .close:hover
        {
            background: url(close.gif) no-repeat 0 0;
        }
        .float_layer .content
        {
            height: 120px;
            overflow: hidden;
            font-size: 14px;
            line-height: 18px;
            color: #666;
            text-indent: 28px;
        }
        .float_layer .wrap
        {
            padding: 10px;
        }
        .style1
        {
            color: #0000FF;
        }
    </style>
    <script type="text/javascript">
        function miaovAddEvent(oEle, sEventName, fnHandler) {
            if (oEle.attachEvent) {
                oEle.attachEvent('on' + sEventName, fnHandler);
            }
            else {
                oEle.addEventListener(sEventName, fnHandler, false);
            }
        }

        // 页面加载后
        function load() {
            // 计算提示框弹出位置
            var oDiv = document.getElementById('miaov_float_layer');
            var oBtnMin = document.getElementById('btn_min');
            var oBtnClose = document.getElementById('btn_close');
            var oDivContent = oDiv.getElementsByTagName('div')[0];

            oDiv.style.display = 'block';

            var iMaxHeight = 0;

            var isIE6 = window.navigator.userAgent.match(/MSIE 6/ig) && !window.navigator.userAgent.match(/MSIE 7|8/ig);

            iMaxHeight = oDivContent.offsetHeight;

            if (isIE6) {
                oDiv.style.position = 'absolute';
                repositionAbsolute();
                miaovAddEvent(window, 'scroll', repositionAbsolute);
                miaovAddEvent(window, 'resize', repositionAbsolute);
            }
            else {
                oDiv.style.position = 'fixed';
                repositionFixed();
                miaovAddEvent(window, 'resize', repositionFixed);
            }

            oBtnMin.timer = null;
            oBtnMin.isMax = true;
            oBtnMin.onclick = function () {
                startMove(
                    oDivContent,
                    (this.isMax = !this.isMax) ? iMaxHeight : 0,
                    function () {
                        oBtnMin.className = oBtnMin.className == 'min' ? 'max' : 'min';
                    }
                );
            };

            // 注册提示框按钮事件
            oBtnClose.onclick = function () {
                oDiv.style.display = 'none';
            };

            oDiv.style.display = 'none';

            // 模拟更换报警值
            setInterval(Change, 1900)

            // 每两秒执行一次 Do方法放在这里执行
            setInterval(Do, 2000);
        }

        // 取0-10范围内的随机数
        function Change() {
            var randNumber = parseInt(Math.random() * 10);
            document.getElementById("Label1").innerHTML = randNumber;
        }

        function startMove(obj, iTarget, fnCallBackEnd) {
            if (obj.timer) {
                clearInterval(obj.timer);
            }
            obj.timer = setInterval(
                function () {
                    doMove(obj, iTarget, fnCallBackEnd);
                },
                30
            );
        }

        function doMove(obj, iTarget, fnCallBackEnd) {
            var iSpeed = (iTarget - obj.offsetHeight) / 8;

            if (obj.offsetHeight == iTarget) {
                clearInterval(obj.timer);
                obj.timer = null;
                if (fnCallBackEnd) {
                    fnCallBackEnd();
                }
            }
            else {
                iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
                obj.style.height = obj.offsetHeight + iSpeed + 'px';

                ((window.navigator.userAgent.match(/MSIE 6/ig) && window.navigator.userAgent.match(/MSIE 6/ig).length == 2) ? repositionAbsolute : repositionFixed)()
            }
        }

        function repositionAbsolute() {
            var oDiv = document.getElementById('miaov_float_layer');
            var left = document.body.scrollLeft || document.documentElement.scrollLeft;
            var top = document.body.scrollTop || document.documentElement.scrollTop;
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = left + width - oDiv.offsetWidth + 'px';
            oDiv.style.top = top + height - oDiv.offsetHeight + 'px';
        }

        function repositionFixed() {
            var oDiv = document.getElementById('miaov_float_layer');
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = width - oDiv.offsetWidth + 'px';
            oDiv.style.top = height - oDiv.offsetHeight + 'px';
        }

        function Do() {
            var text = document.getElementById("Label1").innerHTML;
            // 方便测试,改为大于5提示
            if (parseInt(text) > 5) {
                document.getElementById("number").innerHTML = text;
                document.getElementById("miaov_float_layer").style.display = "block";
            }
            else {
                document.getElementById("miaov_float_layer").style.display = "none";
            }
        }
    </script>
</head>
<body onload="load()">
    <form id="form1" runat="server">
    <div class="float_layer" id="miaov_float_layer">
        <h2>
            <strong>时时数据报警提示</strong> <a id="btn_min" href="javascript:;" class="min"></a><a
                id="btn_close" href="javascript:;" class="close"></a>
        </h2>
        <div class="content">
            <div class="wrap">
                <a href="www.baidu.com">当前在线报警数量<strong><span id="number">数量</span></strong>请尽快处</a>
                <%--<address><span class="MarginLeft10 a">游梁泵数据监测<a href="TWDataMonitorForm.aspx"></a>√</span></address>--%>
            </div>
        </div>
    </div>
    报警数量【<asp:Label ID="Label1" runat="server" BackColor="Red"></asp:Label>
    】<span class="style1">报警数量大于0就进行js提示</span><br />
    报警值填写<asp:TextBox ID="TextBox1" runat="server" ForeColor="Red" Width="69px"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Height="24px" OnClientClick="return false;" Text="设置报警数量"
        Width="100px" />
    <br />
    <br />
    <br />
    <br />

<div style="width:732px; height:200px; background-color:Black; color:Green;">
    <strong style="font-size:large;">
    需要实现的功能不基于Button事件;
    <br />
    <br />自行判断,提示窗口;
    <br />
    <br />
    前提...我用模板页了 所以希望您能帮我解决这个问题
     
    <br />
    <br />
    代码上如何改动 写上注释谢谢! 请各位大牛帮忙
    </strong></div>
    </form>
</body>
</html>

--------------------编程问答-------------------- 例子是在onload事件里执行。
具体到你的项目里再根据你的需求改一下吧。 --------------------编程问答--------------------
引用 7 楼  的回复:
例子是在onload事件里执行。
具体到你的项目里再根据你的需求改一下吧。

我想问一下 我用模板页 了 页面中应该怎么弄? 
如何实现 function load()  --------------------编程问答-------------------- 能不能把调用 功能的那个调用 用jqeury实现?
我用模板页 所以没有body。。。。无法load加载 --------------------编程问答--------------------
引用 8 楼  的回复:
引用 7 楼  的回复:

例子是在onload事件里执行。
具体到你的项目里再根据你的需求改一下吧。

我想问一下 我用模板页 了 页面中应该怎么弄? 
如何实现 function load()

不管你用什么来实现。都是在你这个模块所属的页面进行调用。比如你的这个模块页面A包含在一个母版页M里面,那就在A页面的onload事件里调用。或者在jQuery里的$(document).ready()里面调用 --------------------编程问答--------------------      <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            setInterval(function () {
                //获取Label1控件的客户端ID
                var lblWarnNum = '<%=Label1.ClientID %>';
                //获取Label1控件的jquery对象
                var $lblWarnNum = $("#" + lblWarnNum);
                //获取TextBox1控件的jquery对象
                var $txtNum = $("#TextBox1");
                //如果实际检测值大于报警值
                if ($lblWarnNum.text() > $txtNum.val().trim()) {
                    $("#miaov_float_layer").show(300);
                }
            }, 1000);
        });
    </script> --------------------编程问答-------------------- 整个页面也贴给你吧:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javascript.aspx.cs" Inherits="javascript右下角信息提醒框.javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <style type="text/css">
        *
        {
            padding: 0;
            margin: 0;
        }
        li
        {
            list-style: none;
        }
        body
        {
            background: #eee;
        }
        .float_layer
        {
            width: 300px;
            border: 1px solid #aaaaaa;
            display: none;
            background: #fff;
        }
        .float_layer h2
        {
            height: 25px;
            line-height: 25px;
            padding-left: 10px;
            font-size: 14px;
            color: #333;
            background: url(title_bg.gif) repeat-x;
            border-bottom: 1px solid #aaaaaa;
            position: relative;
        }
        .float_layer .min
        {
            width: 21px;
            height: 20px;
            background: url(min.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .min:hover
        {
            background: url(min.gif) no-repeat 0 0;
        }
        .float_layer .max
        {
            width: 21px;
            height: 20px;
            background: url(max.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 25px;
        }
        .float_layer .max:hover
        {
            background: url(max.gif) no-repeat 0 0;
        }
        .float_layer .close
        {
            width: 21px;
            height: 20px;
            background: url(close.gif) no-repeat 0 bottom;
            position: absolute;
            top: 2px;
            right: 3px;
        }
        .float_layer .close:hover
        {
            background: url(close.gif) no-repeat 0 0;
        }
        .float_layer .content
        {
            height: 120px;
            overflow: hidden;
            font-size: 14px;
            line-height: 18px;
            color: #666;
            text-indent: 28px;
        }
        .float_layer .wrap
        {
            padding: 10px;
        }
        .style1
        {
            color: #0000FF;
        }
    </style>
    <script type="text/javascript">
        function miaovAddEvent(oEle, sEventName, fnHandler) {
            if (oEle.attachEvent) {
                oEle.attachEvent('on' + sEventName, fnHandler);
            }
            else {
                oEle.addEventListener(sEventName, fnHandler, false);
            }
        }

        function load() {
            var oDiv = document.getElementById('miaov_float_layer');
            var oBtnMin = document.getElementById('btn_min');
            var oBtnClose = document.getElementById('btn_close');
            var oDivContent = oDiv.getElementsByTagName('div')[0];

            oDiv.style.display = 'block';

            var iMaxHeight = 0;

            var isIE6 = window.navigator.userAgent.match(/MSIE 6/ig) && !window.navigator.userAgent.match(/MSIE 7|8/ig);

            iMaxHeight = oDivContent.offsetHeight;

            if (isIE6) {
                oDiv.style.position = 'absolute';
                repositionAbsolute();
                miaovAddEvent(window, 'scroll', repositionAbsolute);
                miaovAddEvent(window, 'resize', repositionAbsolute);
            }
            else {
                oDiv.style.position = 'fixed';
                repositionFixed();
                miaovAddEvent(window, 'resize', repositionFixed);
            }

            oBtnMin.timer = null;
            oBtnMin.isMax = true;
            oBtnMin.onclick = function () {
                startMove(
                    oDivContent,
                    (this.isMax = !this.isMax) ? iMaxHeight : 0,
                    function () {
                        oBtnMin.className = oBtnMin.className == 'min' ? 'max' : 'min';
                    }
                );
            };

            oBtnClose.onclick = function () {
                oDiv.style.display = 'none';
            };

            oDiv.style.display = 'none';
        }

        function startMove(obj, iTarget, fnCallBackEnd) {
            if (obj.timer) {
                clearInterval(obj.timer);
            }
            obj.timer = setInterval(
                function () {
                    doMove(obj, iTarget, fnCallBackEnd);
                },
                30
            );
        }

        function doMove(obj, iTarget, fnCallBackEnd) {
            var iSpeed = (iTarget - obj.offsetHeight) / 8;

            if (obj.offsetHeight == iTarget) {
                clearInterval(obj.timer);
                obj.timer = null;
                if (fnCallBackEnd) {
                    fnCallBackEnd();
                }
            }
            else {
                iSpeed = iSpeed > 0 ? Math.ceil(iSpeed) : Math.floor(iSpeed);
                obj.style.height = obj.offsetHeight + iSpeed + 'px';

                ((window.navigator.userAgent.match(/MSIE 6/ig) && window.navigator.userAgent.match(/MSIE 6/ig).length == 2) ? repositionAbsolute : repositionFixed)()
            }
        }

        function repositionAbsolute() {
            var oDiv = document.getElementById('miaov_float_layer');
            var left = document.body.scrollLeft || document.documentElement.scrollLeft;
            var top = document.body.scrollTop || document.documentElement.scrollTop;
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = left + width - oDiv.offsetWidth + 'px';
            oDiv.style.top = top + height - oDiv.offsetHeight + 'px';
        }

        function repositionFixed() {
            var oDiv = document.getElementById('miaov_float_layer');
            var width = document.documentElement.clientWidth;
            var height = document.documentElement.clientHeight;

            oDiv.style.left = width - oDiv.offsetWidth + 'px';
            oDiv.style.top = height - oDiv.offsetHeight + 'px';
        }

        function Do() {
            var text = document.getElementById("TextBox1").value;
            if (parseInt(text) > 0) {
                document.getElementById("Label1").innerHTML = text;
                document.getElementById("number").innerHTML = text;
                document.getElementById("miaov_float_layer").style.display = "block";
            }
            else {
                document.getElementById("miaov_float_layer").style.display = "none";
            }
        }
    </script>
     <script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            setInterval(function () {
                //获取Label1控件的客户端ID
                var lblWarnNum = '<%=Label1.ClientID %>';
                //获取Label1控件的jquery对象
                var $lblWarnNum = $("#" + lblWarnNum);
                //获取TextBox1控件的jquery对象
                var $txtNum = $("#TextBox1");
                //如果实际检测值大于报警值
                if ($lblWarnNum.text() > $txtNum.val().trim()) {
                    $("#miaov_float_layer").show(300);
                }
            }, 1000);
        });
    </script>
</head>
<body onload="load()">
    <form id="form1" runat="server">
    <div class="float_layer" id="miaov_float_layer">
        <h2>
            <strong>时时数据报警提示</strong> <a id="btn_min" href="javascript:;" class="min"></a><a
                id="btn_close" href="javascript:;" class="close"></a>
        </h2>
        <div class="content">
            <div class="wrap">
                <a href="www.baidu.com">当前在线报警数量<strong><span id="number">数量</span></strong>请尽快处</a>
                <%--<address><span class="MarginLeft10 a">游梁泵数据监测<a href="TWDataMonitorForm.aspx"></a>√</span></address>--%>
            </div>
        </div>
    </div>
    报警数量【<asp:Label ID="Label1" runat="server" BackColor="Red">1</asp:Label>
    】<span class="style1">报警数量大于0就进行js提示</span><br />
    报警值填写<asp:TextBox ID="TextBox1" runat="server" ForeColor="Red" Width="69px">0</asp:TextBox>
    <asp:Button ID="Button1" runat="server" Height="24px" OnClick="Button1_Click" OnClientClick="Do(); return false;"
        Text="设置报警数量" Width="100px" />
    <br />
    <br />
    <br />
    <br />
    <div style="width: 732px; height: 200px; background-color: Black; color: Green;">
        <strong style="font-size: large;">需要实现的功能不基于Button事件;
            <br />
            <br />
            自行判断,提示窗口;
            <br />
            <br />
            前提...我用模板页了 所以希望您能帮我解决这个问题
            <br />
            <br />
            代码上如何改动 写上注释谢谢! 请各位大牛帮忙 </strong>
    </div>
    </form>
</body>
</html>
--------------------编程问答--------------------
引用 12 楼  的回复:
整个页面也贴给你吧:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javascript.aspx.cs" Inherits="javascript右下角信息提醒框.javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN……


我现在最发愁的是 真实项目 使用模板页 ....所以...都不好使 啊 --------------------编程问答--------------------
引用 13 楼  的回复:
引用 12 楼  的回复:
整个页面也贴给你吧:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javascript.aspx.cs" Inherits="javascript右下角信息提醒框.javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ……

使用母版页和不用母版页差别很大么?本质上都是html和javascript。 --------------------编程问答--------------------
引用 14 楼  的回复:
引用 13 楼 的回复:

引用 12 楼 的回复:
整个页面也贴给你吧:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="javascript.aspx.cs" Inherits="javascript右下角信息提醒框.javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//……

首先第一个区别是没有 html框架整体 body根本没有...
其次javascript 很多功能都被限制了 郁闷啊

--------------------编程问答-------------------- 你QQ多少我的是QQ30520626  这个问题已经困扰我好多天了 发贴一大堆 500多积分都快没了....
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,