代码空间项目 -- alert窗口自定义
function z_alert(msg){
//创建提示框盒子,设置盒子的css样式
var msgBox=document.createElement("div");
msgBox.style.width="300px";
msgBox.style.borderRadius="5px";
msgBox.style.position="fixed";
msgBox.style.zIndex=100000;
var maxleft=(window.innerWidth-400)/2;
msgBox.style.top="100px";
msgBox.style.left=maxleft+"px";
//创建遮荫层,背景变暗
var bg=document.createElement("div");
bg.style.height=window.innerHeight+"px";
bg.style.width=window.innerWidth+"px";
bg.style.position="fixed";
msgBox.style.zIndex=99999;
bg.style.top="0px";
bg.style.left="0px";
bg.style.background="black";
bg.style.opacity="0.2";
//创建标题
var msgTitle=document.createElement("div");
msgTitle.style.lineHeight="40px";
msgTitle.style.borderTopLeftRadius="5px";
msgTitle.style.borderTopRightRadius="5px";
msgTitle.style.background="背景图片地址";
msgTitle.style.color="#fff";
msgTitle.style.fontSize="18px";
//移动上去鼠标的样式
msgTitle.style.cursor="move";
msgTitle.style.textAlign="center";
var span=document.createElement("span");
span.innerText="提示";
//创建内容部分的盒子
var content=document.createElement("div");
content.style.height="100px";
content.style.background="#fff";
//传入的提示信息参数
content.innerText=msg;
content.style.overflowY="auto";
content.style.textAlign="center";
content.style.verticalAlign="middle";
content.style.padding="40px";
//创建盒子底部
var bottom=document.createElement("div");
bottom.style.height="30px";
bottom.style.background="#149BDF";
bottom.style.padding="5px";
bottom.style.borderBottomLeftRadius="5px";
bottom.style.borderBottomRightRadius="5px";
//创建关闭按钮
var close=document.createElement("div");
close.innerHTML="确定";
close.style.cursor="pointer";
close.style.width="65px";
close.style.padding="3px 15px";
close.style.background="#fff";
close.style.borderRadius="3px";
close.style.margin="0 auto";
close.style.textAlign="center";
close.onclick=function(){
msgBox.style.visibility="hidden";
bg.style.visibility="hidden";
}
//拼接各级元素
msgBox.appendChild(msgTitle);
msgTitle.appendChild(span);
msgBox.appendChild(content);
msgBox.appendChild(bottom);
bottom.appendChild(close);
document.body.appendChild(msgBox);
document.body.appendChild(bg);
}
代码空间项目 -- alert窗口自定义的更多相关文章
- 代码空间项目 -- InstantiationException的异常
java.lang.InstantiationException实例化异常.当试图通过newInstance()方法创建某个类的实例,而该类是一个抽象类或接口时,抛出该异常. 这次项目中查询type时 ...
- 代码空间项目 -- 获取当前时间之前的某一天-Calender类的使用
Calendar类的静态方法getInstance()可以初始化一个日历对象:Calendar now = Calendar.getInstance(); 1.Calendar的基本用法calenda ...
- 代码空间项目 -- cookie的基本使用
cookie在日常开发b/s架构时候经常使用,可以在记住用户,方便自动登录,也可以记住用户的偏好并对应推送广告 下面说说开发时候的基本用法: 1.创建cookie//设置cookie,键值对形式Coo ...
- c++实现输入法窗口自定义的代码
#pragma once #include <Windows.h> #include <imm.h> #include <string> #pragma comme ...
- VS Code项目中共享自定义的代码片段方案
VS Code项目中共享自定义的代码片段方案 一.问题背景 项目中注释风格不统一,如何统一注释风格 一些第三方组件库名称太长,每次使用都需要找文档,然后复制粘贴 部分组件库有自己的Snippets插件 ...
- 雷林鹏分享:jQuery EasyUI 窗口 - 自定义窗口工具栏
jQuery EasyUI 窗口 - 自定义窗口工具栏 默认情况下,窗口(window)有四个工具:collapsible.minimizable.maximizable 和 closable.比如我 ...
- 超详细的Xcode代码格式化教程,可自定义样式。
超详细的Xcode代码格式化教程,可自定义样式. 为什么要格式化代码 当团队内有多人开发的时候,每个人写的代码格式都有自己的喜好,也可能会忙着写代码而忽略了格式的问题.在之前,我们可能会写完代码后,再 ...
- jeecg项目子窗口获得父窗口元素id
jeecg项目子窗口获得父窗口元素id, var parentWin = frameElement.api.opener;alert($(parentWin.document).find(" ...
- 雷林鹏分享:jQuery EasyUI 窗口 - 自定义带有工具条和按钮的对话框
jQuery EasyUI 窗口 - 自定义带有工具条和按钮的对话框 您可以创建一个带有工具栏(toolbar)和按钮(button)的对话框(dialog),可以从 HTML 标记创建.这个教程描述 ...
随机推荐
- nrm+nvm
一.nvm的安装和使用 nvm全称Node Version Manager是 Nodejs 版本管理器,它让我们能方便的对 Nodejs 的版 本进行切换. nvm 的官方版本只支持 Linux ...
- 1004 Counting Leaves
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family member ...
- MySQL 服务无法启动-问题处理
症状:前一天在MySQL中删除了几个不用的数据库后登陆MySQL出现以下错误: mysql -u root -p passwd ERROR 2002 (HY000): Can't connec ...
- DevExpress控件GridControl使用 z
设置选中行的背景色.而不改变前景色. EnableAppearanceFocusedCell = False, EnableAppearanceFocusedRow = False private v ...
- SpringMVC同时支持多视图(JSP,Velocity,Freemarker等)的一种思路实现
在基于SpringMVC的项目中有时需要同时使用多种视图格式,如jsp,velocity及freemarker等,通过不同的请求路径配置规则,映射到不同的视图文件.下面我提供一种思路,通过视图模板文件 ...
- Git安装及SSH Key管理之Windows篇
一.安装环境 1.本机系统:Windows 10 Pro(64位)2.Git版本:Git-2.11.0-64-bit.exe(64位) 二.Git安装 去官网下载完后一路下一步完成安装,如下图: ...
- php 的$_POST 和$_REQUEST的区别
发现$_POST 没数据,而$_REQUEST 有数据 ----------------------------------------- https://stackoverflow.com/ques ...
- Android API Guides---Services
服务 在该文献 基础 声明在清单服务 创建一个启动的服务 扩展IntentService类 扩展服务类 启动服务 停止服务 创建绑定服务 将通知发送给用户 执行在前台服务 管理服务生命周期 实施生命周 ...
- java 发送微信客服消息
package com.baosight.wechat.service; import net.sf.json.JSONObject; import org.apache.commons.httpcl ...
- erlang 小程序:整数序列,搜索和为正的最长子序列
近期学习了一下erlang, 编了个小程序 算法例如以下: 把參数分为三个 当前位置的前子序列(Save)(比方 -5, 1,2,-1, _, ... ) 当前位置为_时, 前子序列就是 1,2,-1 ...