代码如下:/** * 得到中英文字符长 * @param {} str * @return {} */ function LengthB(str){ var p1 = new RegExp(%u.., g) var p2 = new RegExp(%., g) return escape(str).replace(p1, ).replace(p2, ).length } /** * 过滤所有空格字符 * @param {Object} str */ function jsTrim(str){ str += ""; while ((str.charAt(0) == ) || (str.charAt(0) == ???) || (escape(str.charAt(0)) == %u3000)) str = str.substring(1, str.l...
先上个效果图,可以点击Close按钮或是在遮罩层上任意处点击,就可以关闭弹出层。HTML代码 代码如下: 标题位置 正文内容 代码很简洁。最外层是一个大的DIV作为弹出层的容器,H4作为弹出层的标题,又一个DIV用于弹出层正文内容显示,再一个Div用于放置一些按钮。 CSS代码 代码如下:.pop-box { z-index: 9999; /*这个数值要足够大,才能够显示在最上层*/ margin-bottom: 3px; display: none; position: absolute; background:...
javascript代码,一般放到 head中 代码如下: 下面的代码放到body中 代码如下: 教育的意义 具体的实现代码测试:脚本之家 1300) closeDiv() //客户想不用自动消失由用户来自己关闭所以屏蔽这句 try{ divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10) divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10) docWidth = document.body.clie...
解决在自身可以用iframe 也可以在自身使用 然后 window.close(); 提交到父窗口可以改变target
网上搜索到的代码,做了一些修改该, 修正无法自定义颜色,修正IE8 下错误,以及其他小BUG 兼容IE6~8以及火狐 可以自定义 // 提示窗口标题高度 // 提示窗口的边框颜色 // 提示窗口的标题颜色 // 提示窗口的标题背景色 // 提示内容的背景色 // 提示内容文字对齐方式 功能 可以弹出一个大DIV遮住页面(IE下 透明) 然后在屏幕中央显示显示一个小DIV 可用作功能提示 操作提示 以及公告等 提示内容可以使带HTML标记的文字,也可是一个页面链接...
代码如下:// 显示确认对话框 function showConfirm(txtTitle, txtMsg, callback){ getDivDialog().text(txtMsg).dialog({ modal: true , overlay: { opacity: 0.5 } , title: txtTitle ,buttons: { "是" : function(){ callback(); $(this).dialog("close"); } ,"否" : function(){ $(...
代码如下:function jb51tuitan(){ if (getCookie(jb51popped)==){ //要执行的代码或一些操作setCookie("jb51popped","ok"); //写入cookies表示已经执行过了。 alert("ok"); } } jb51tuitan() function setCookie(name, value) { var argv = setCookie.arguments; var argc = setCookie.arguments.length; var expires = (argc > 2) ? argv[2] : null; if(expires!=null) { var LargeExpDate = new...
补增一个效果图! 模拟Popup body{ margin:0; padding:0; text-align:center; } #container{ margin:50px auto; padding:10px auto; } #popupcontent{ position:absolute; border:1px solid #000000; line-height:17px; background-color:#F7F7F4; visibility:hidden; cursor:default; padding:2 5 2 5px; } "; ocbody += "当前颜色"; for(var i=0;i"; ocbody += ""; if(i%6==5) ocbody += ""; } ocbody += ""; oPopB...
问题:做一个带拖动的弹出层效果(像提示框那种) 先写了一半,明天继续奋斗: javascript 弹出层居中效果的制作 * { padding:0; margin:0; list-style:none; } body { font-family:Verdana, Geneva, sans-serif; font-size:14px; } #a { width:300px; height:80px; border:5px solid #d3d3d3; background-color:#f7f7f7; position:absolute; padding:10px; } a.btn { display:block; width:80px; cursor:pointer; background-color:#f7...
代码如下:// JavaScript Document var dv; var dvMsg; function customalert() { dvMsg = document.createElement("div"); dvMsg.style.position = "absolute"; dvMsg.setAttribute(id, msg); dvMsg.style.width = "600px"; dvMsg.style.padding = "10 0 2 0"; dvMsg.style.height = "313px"; dvMsg.style.background = "#EF621D"; dvMsg.style.border = "1px solid #6699dd"; dvMsg.style.zIndex = "1112"; document.body.appendC...
代码如下:onclick=checkopen(this); href="http://www.gxlcms.com" target=_blank>打开下载页面1 var original_url = "" var adurl = new Array(9); var isclick = false; var adurl_i = 5; adurl[0] = "http://www.gxlcms.com"; adurl[1] = "http://www.yuanma51.com/"; adurl[2] = "http://www.baidu.com/"; function selectFrom(iFirstValue,iLastValue){ var iChoces = Math.abs(iLastValue - iFirstValue) + 1; return Math....
有些网站接了一些广告,可以不用弹窗可以用这个脚本控制实现,内容显示的地方需要有个id,因为这样好控制,不能点击任何地方都出现吧,这样可以增加用户体验。 代码如下:var adurl = new Array(9); var adurl_i = 0; adurl[0] = "http://www.gxlcms.com/"; adurl[1] = "http://www.baidu.com/"; adurl[2] = "http://www.g.cn/"; adurl[3] = "http://s.jb51.net/"; adurl[4] = "http://play.jb51.net"; adurl[5] = "http://pda.jb51...
代码如下: 层的扩展与收缩 function StretchDiv(divid,color){ var target; var flag=false; var onMouseDown=function(){ if(flag){ var h=parseInt(target.style.height); onMouseDown.shortDiv=function(){ h=h-1; if(h200){ return; } target.style.height=h+"px"; setTimeout(onMouseDown.longDiv,30); } onMouseDown.longDiv(); } flag=!flag; } function init(){ target=document.getElementById(divid...
原来我们要写一个客户端的特效,要写一两天的JavaScript,然后再调试一两天,才可以看见端倪。现在我们只要使用JQuery和他的 plugin,就可以任意的实现我们脑海中的特效,感谢他们的编写者对人类的贡献(一百个西红柿砸过来。。。。。。。。。。。。。。)。我今天实现的需求是一个需要从列表页面中选择要导出到word中的列,然后在将选中列的内容导出到word中,同时为了增加通用性,列的个数不是固定的,也就是说这张表格可能是4列...
图1(弹出一个div)图2(弹出多个)构造函数: 代码如下: var DivWindow= function(popup/*最外层div id*/,popup_drag/*拖动div id*/,popup_exit/*退出按钮id*/ ,exitButton/*触发服务器端退出按钮id*/,varwidth,varheight,zindex){ this.popup =popup ; this.height =varheight ; //窗口高度,并没用来设置窗口高度宽度,用来定位在屏幕的位置 this.width =varwidth ; //窗口宽度 this.popup_exit=popup_exit; this.exitButton=ex...