Html 弹出层 自定义提示信息
2016-09-08 16:15
435 查看
写一个弹出层显示提示信息,好处多多。。。。
1.属性:
display:none;//是一个Div层不显示 position:fixed;left:0px;top:0px;//将一个层固定在页面某个位置 border-radius: 6px;//圆角边框
2.代码:
<style> input:focus { border: 1px solid #2468a2; } .btn { width: 100px; height: 30px; border-radius: 6px; border-color: #787878; background-color: #AAAAAA; margin-top: 10px; } </style> <script type="text/javascript"> //监听按钮状态 function radiusButtonListener(id) { for (var i = 1; i <= 3; i++) { document.getElementById("radiusBtn" + i).style.backgroundColor = "#AAAAAA"; document.getElementById("radiusBtn" + i).style.width = "100px"; } document.getElementById("radiusBtn" + id).style.backgroundColor = "transparent"; document.getElementById("radiusBtn" + id).style.width = "120px"; } function radiusButton(obj) {//按钮响应 show(obj); } //输出信息 function show(mes) { document.getElementById("hid").style.display = "";//显示弹出层 document.getElementById("text").innerHTML = mes;//设置信息内容 setTimeout(function() { document.getElementById("hid").style.display = "none";//关闭弹出层 }, 2000); } </script> <body> <br> <br> <br> <br> <div style="height: 150px; "> <!-- 三个测试按钮 --> <input id="radiusBtn1" type="button" class="btn" value="一个Button" onclick="radiusButtonListener(1);radiusButton(this.value);"></br> <input id="radiusBtn2" type="button" class="btn" value="一个弹出层" onclick="radiusButtonListener(2);radiusButton(this.value);"> </br> <input id="radiusBtn3" type="button" class="btn" value="一行文字" onclick="radiusButtonListener(3);radiusButton(this.value);"> </div> <!-- 弹出层--> <div id="hid" align="center" style="position:fixed;left:10px;top:250px;border-radius: 6px;width:200px;height: 30px;background-color: #7A7A7A;display:none;line-height:30px;color:white;"> <!-- 弹出信息 --> <span id="text" ></span> </div> </body>
3.图片:
相关文章推荐
- 自定义Django Admin保存时弹出的提示信息
- android 自定义POP window弹出窗口,用于信息提示
- qtp 获取弹出提示框(异常框)的文本显示信息(正则表达式和自定义函数应用)
- 自定义提示信息弹出层
- PHP自定义弹出消息类,用于弹出提示信息并返回
- 一个不错的可拖动层遮罩加ALPHA滤镜(点击弹出后背景变浅色,信息提示框效果)
- java弹出窗口提示信息
- servlet 提示信息弹出警告框后成功重定向
- servlet 提示信息弹出警告框后成功重定向
- 非常漂亮的让背景如此暗淡(一种弹出提示信息时页面背景色调改变的方法)
- [转]页面外仿 MSN 弹出提示信息的脚本改进版(仅能在IE下运行!)
- 一个不错的可拖动层遮罩加ALPHA滤镜(点击弹出后背景变浅色,信息提示框效果)
- 框架中多个页面验证用户身份,弹出提示信息的一点技巧
- 如何在使用了updatepanel后弹出提示信息
- 后台弹出javascript提示信息两方法小知识
- 一种弹出提示信息时页面背景色调改变的方法
- 网页右下角弹出短信息提示
- 利用html:error和html:message标签实现信息提示
- 让背景如此暗淡(一种弹出提示信息时页面背景色调改变的方法)
- ASP.NET中使用javascript弹出提示信息