zoukankan      html  css  js  c++  java
  • 精致的JS提示

    他是一个用户自定义控件;

    他只有1174个字节;

    他能兼容任何浏览器;

    他弹出来是如此的优雅,隐藏是那么自然;

    他是如此的精致,绝对没有任何性能影响;

    最重要的是他是陈太汉开发的;

    文件名:TipControl.ascx

    <%@ Control Language="C#"%>
    <div id="divTip" style="300px;height:100px;position:absolute;top:240px;font-size:15px; border:#c60000 thin solid;display:none;" runat="server">
    <div style=" background-color:#c60000; height:20px;">
    <div style="margin-left:3px;color:White;font-weight:bold">温馨提示</div>
    </div>
    <div style="margin-top:23px;text-align:center;"><asp:Label ID="lbContent" runat="server"/></div>
    </div>
    <script language="javascript" type="text/javascript">
    function ShowTip(tip) {
    parent.document.documentElement.scrollTop
    = parent.document.documentElement.scrollHeight;//滚动条置顶
    document.getElementById("<%=divTip.ClientID%>").style.display = "block";
    document.getElementById(
    "<%=divTip.ClientID%>").style.left = (document.body.scrollWidth - 300) / 2 + "px";
    document.getElementById(
    "<%=divTip.ClientID%>").style.top = parent.document.documentElement.scrollHeight/2-100 + "px";
    document.getElementById("<%=lbContent.ClientID%>").innerHTML = tip;
    setTimeout(
    "document.getElementById('<%=divTip.ClientID%>').style.display = 'none'", 3000);
    }
    </script>

    测试页面

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestJS.aspx.cs" Inherits="JQueryTest.TestJS" %>
    <%@ Register Src="~/UserControl/TipControl.ascx" TagName="uc" TagPrefix="ua" %>
    <!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 runat="server">
    <title></title>
    <script type="text/javascript" src="js/jquery.tools.min.js"></script>

    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <ua:uc runat="server" ID="fdfdf" />
    <input type="button" value="测试" onclick="ShowTip('陈太汉提示您,有消息');"
    </div
    >
    </form>
    </body>
    </html>
  • 相关阅读:
    uva 1391(2-SAT)
    uva 1146(2-SAT+二分判断)
    uva 12167(强连通分支)
    uva 11324(强连通分支+DAG)
    Codeforces Round #227 (Div. 2) 解题报告
    uva 10319(2-SAT)
    uva 610(割边)
    uva 11504(强连通分支)
    测试:网页测试,入门面试题
    测试:安装包的测试
  • 原文地址:https://www.cnblogs.com/hlxs/p/2087978.html
Copyright © 2011-2022 走看看