当前位置: 首页 > news >正文

手机网站开发技术路线/百度统计手机app

手机网站开发技术路线,百度统计手机app,中国建筑集团网,马鞍山市直网站集约化建设由于系统默认alert弹出窗口不能自定义样式,有可能不符合网站的风格,虽然网上应该有很多这样的JS但是还是自己写的比较放心,顺便练习一下对DOM的操作支持IE6下的SELECT不能遮罩的问题,谷歌支持圆角,IE6下就比较丑了&…

5268f80b9b1e01f982625ef6fac83ca1.png

由于系统默认alert弹出窗口不能自定义样式,有可能不符合网站的风格,虽然网上应该有很多这样的JS

但是还是自己写的比较放心,顺便练习一下对DOM的操作

支持IE6下的SELECT不能遮罩的问题,谷歌支持圆角,IE6下就比较丑了,四四方方的,不过可以自定义自己喜欢的样式

听取建议后,修改了position:fixed, IE6下用hack处理了。

点击看效果:

点击模拟Alert弹出框

点击模拟Alert弹出框

点击模拟Alert弹出框

所需CSS:

使用方法,直接调用函数,传递所需定义的信息,支持定义是否有取消键:

alertMsg(msg, mode) //mode为空,即只有一个确认按钮,mode为1时有确认和取消两个按钮

点击模拟Alert弹出框

点击模拟Alert弹出框

点击模拟Alert弹出框

函数代码:添加了一个获取窗口尺寸的函数,又长长了很多,可以把获取窗口的尺寸另外立一个函数放公共库里面,这里只是为了方便演示,写到一个函数里面

function alertMsg(msg, mode) { //mode为空,即只有一个确认按钮,mode为1时有确认和取消两个按钮 msg = msg || ''; mode = mode || 0; var top = document.body.scrollTop || document.documentElement.scrollTop; var isIe = (document.all) ? true : false; var isIE6 = isIe && !window.XMLHttpRequest; var sTop = document.documentElement.scrollTop || document.body.scrollTop; var sLeft = document.documentElement.scrollLeft || document.body.scrollLeft; var winSize = function(){ var xScroll, yScroll, windowWidth, windowHeight, pageWidth, pageHeight; // innerHeight获取的是可视窗口的高度,IE不支持此属性 if (window.innerHeight && window.scrollMaxY) { xScroll = document.body.scrollWidth; yScroll = window.innerHeight + window.scrollMaxY; } else if (document.body.scrollHeight > document.body.offsetHeight) { // all but Explorer Mac xScroll = document.body.scrollWidth; yScroll = document.body.scrollHeight; } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari xScroll = document.body.offsetWidth; yScroll = document.body.offsetHeight; } if (self.innerHeight) { // all except Explorer windowWidth = self.innerWidth; windowHeight = self.innerHeight; } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode windowWidth = document.documentElement.clientWidth; windowHeight = document.documentElement.clientHeight; } else if (document.body) { // other Explorers windowWidth = document.body.clientWidth; windowHeight = document.body.clientHeight; } // for small pages with total height less then height of the viewport if (yScroll < windowHeight) { pageHeight = windowHeight; } else { pageHeight = yScroll; } // for small pages with total width less then width of the viewport if (xScroll < windowWidth) { pageWidth = windowWidth; } else { pageWidth = xScroll; } return{ 'pageWidth':pageWidth, 'pageHeight':pageHeight, 'windowWidth':windowWidth, 'windowHeight':windowHeight } }(); //alert(winSize.pageWidth); //遮罩层 var styleStr = 'top:0;left:0;position:absolute;z-index:10000;background:#666;width:' + winSize.pageWidth + 'px;height:' + (winSize.pageHeight + 30) + 'px;'; styleStr += (isIe) ? "filter:alpha(opacity=80);" : "opacity:0.8;"; //遮罩层DIV var shadowDiv = document.createElement('div'); //添加阴影DIV shadowDiv.style.cssText = styleStr; //添加样式 shadowDiv.id = "shadowDiv"; //如果是IE6则创建IFRAME遮罩SELECT if (isIE6) { var maskIframe = document.createElement('iframe'); maskIframe.style.cssText = 'width:' + winSize.pageWidth + 'px;height:' + (winSize.pageHeight + 30) + 'px;position:absolute;visibility:inherit;z-index:-1;filter:alpha(opacity=0);'; maskIframe.frameborder = 0; maskIframe.src = "about:blank"; shadowDiv.appendChild(maskIframe); } document.body.insertBefore(shadowDiv, document.body.firstChild); //遮罩层加入文档 //弹出框 var styleStr1 = 'display:block;position:fixed;_position:absolute;left:' + (winSize.windowWidth / 2 - 200) + 'px;top:' + (winSize.windowHeight / 2 - 150) + 'px;_top:' + (winSize.windowHeight / 2 + top - 150)+ 'px;'; //弹出框的位置 var alertBox = document.createElement('div'); alertBox.id = 'alertMsg'; alertBox.style.cssText = styleStr1; //创建弹出框里面的内容P标签 var alertMsg_info = document.createElement('P'); alertMsg_info.id = 'alertMsg_info'; alertMsg_info.innerHTML = msg; alertBox.appendChild(alertMsg_info); //创建按钮 var btn1 = document.createElement('a'); btn1.id = 'alertMsg_btn1'; btn1.href = 'javas' + 'cript:void(0)'; btn1.innerHTML = '确定'; btn1.onclick = function () { document.body.removeChild(alertBox); document.body.removeChild(shadowDiv); return true; }; alertBox.appendChild(btn1); if (mode === 1) { var btn2 = document.createElement('a'); btn2.id = 'alertMsg_btn2'; btn2.href = 'javas' + 'cript:void(0)'; btn2.innerHTML = '取消'; btn2.onclick = function () { document.body.removeChild(alertBox); document.body.removeChild(shadowDiv); return false; }; alertBox.appendChild(btn2); } document.body.appendChild(alertBox); }

点击模拟Alert弹出框

点击模拟Alert弹出框

点击模拟Alert弹出框

1428d0e076c3959ab11d28a39bc84fab.png

5268f80b9b1e01f982625ef6fac83ca1.png

本条技术文章来源于互联网,如果无意侵犯您的权益请点击此处反馈版权投诉

本文系统来源:php中文网

http://www.jmfq.cn/news/4867003.html

相关文章:

  • 辽宁工程建设信息网站/网站结构有哪几种
  • 各大网站大全/网站设计培训
  • 加盟网站制作运营/网络营销与直播电商专业就业前景
  • 自助建站软件自动建站系统/快速排名工具免费
  • 电商网站100排行榜/个人网站搭建
  • 做啤酒纸箱包装的网站/网上引流推广怎么做
  • 浙江网站建设情况/cctv 13新闻频道
  • 帝国+只做网站地图/百度排名规则
  • 网站开发支付超时如何解决/项目网
  • 网站建设要学哪些方面/网络小说排行榜
  • 自己做的网站如何让百度搜索/企业如何建立网站
  • 做教程网站如何查用户搜索/seo查询源码
  • 网站seo怎么做/百度认证营销推广师
  • 设计家装修网站/优化方案模板
  • 怎么知道一个网站是哪家公司做的/网站seo技术教程
  • 免费自己做网站/推广方式有哪几种
  • 网站绑定微信公众号/网站平台如何推广
  • b2b商城网站开发/网络营销的手段包括
  • 中国建设论坛网站大全/长沙网站seo
  • 网站建设供应商税点/军事新闻今日最新消息
  • 做图片的网站都有哪些/市场营销推广方案
  • 网站从建设到运行要多少钱/石家庄seo管理
  • 做墙绘一般在哪个网站/友情链接购买网站
  • 委托网站开发所有权归属/销售管理怎么带团队
  • 网站空间的管理站点/营销推广渠道
  • 产品做网站不花钱/2020最近的新闻大事10条
  • 网站的域名都有哪些/网站seo方案模板
  • 昆明婚恋网站价格/北京环球影城每日客流怎么看
  • php网站服务器怎么来/百度手机助手app下载安装
  • 学校建设网站的意义/潍坊网站建设seo