服务器与运维

当前位置:澳门新莆京娱乐官网 > 服务器与运维 > 实用函数的使用详解_javascript技巧_脚本之家澳门新莆京娱乐官网

实用函数的使用详解_javascript技巧_脚本之家澳门新莆京娱乐官网

来源:http://www.drgigabytes.com 作者:澳门新莆京娱乐官网 时间:2019-12-28 22:21
  • url + "n" txt += "行数: " + line + "nn" alert; return false;}

}

  • "px"; box.style.top = y + "px"; box.style.margin = "auto"; } } } document.onmouseup = function (){moveable = false;};}

function showWindow(boxId, closeId, showBg){//弹窗 htmlRoot = getHtmlRoot(); box = document.getElementById; boxId = '#' + boxId; closeId = '#' + closeId; showBox = $; showBox.show(); z_index = 20; moveLeft = (htmlRoot.clientWidth- box.clientWidth)/2 + htmlRoot.scrollLeft +'px'; moveTop = (htmlRoot.clientHeight - box.clientHeight)/2 + htmlRoot.scrollTop;+'px'; showBox.css({position:'absolute', left:moveLeft,zIndex:z_index, top:moveTop});

function checkEmail分隔的Email格式*/if{ if == -1卡塔尔{ //indexOf返有些字符串在源字符串中第叁次面世的地点,退步重回-1 if{ alert; document.getElementById; return false; } }else{ var emailArr = email.split;//split字符串分割成字符串数组 var i, iMax = emailArr.length; for{ if(emailArr[i] != null || emailArr != ""卡塔尔(قطر‎{ if卡塔尔(قطر‎{ alert("几个邮箱格式中有邮箱格式不允许确,请重新检查核对后再输入!"State of Qatar; document.getElementById; return false; } } } } }function isEmail{ var reg = /^+$/; return reg.test检查实验叁个字符串是还是不是协作有些情势.}}

function setAutoWidth{//最小或最大幅度面 var obj = document.getElementById{ obj.style.width = (obj.clientWidth > width卡塔尔? width + "px" : "auto"; }else{ obj.style.width = (obj.clientWidth < width卡塔尔(قطر‎ ? width + "px" : "auto"; }}

function getHtmlRoot(){/*拿到html文书档案的根成分*/ if(document.compatMode.toLowerCase{ htmlRoot = document.documentElement; }else{ htmlRoot = document.body; } return htmlRoot;}

function fontScroll{/*澳门新莆京娱乐官网 ,向左滚动的文字 */ var obj = document.getElementById; var text = obj.innerHTML; var first = text.charAt; var left = text.substring; obj.inerHTML = left + first; //这些写函数之外 setInterval', 500State of Qatar;}

function getFormQuery{/*调换查询字串*/ formObj = document.getElementById; var i, queryString = "", and = "", itemValue; for(i = 0; i

function boxMove{//可移动的层 var w = box.scrollWidth,h = box.scrollHeight; var iWidth = document.documentElement.clientWidth; var iHeight = document.documentElement.clientHeight; var moveX = 0,moveY = 0,moveTop = 0,moveLeft = 0,moveable = false; box.onmousedown = function{ moveable = true; e = window.event?window.event:e; moveX = e.clientX-box.offsetLeft; moveY = e.clientY-box.offsetTop; box.style.zIndex++; } document.onmousemove = function{ e = window.event?window.event:e; var x = e.clientX - moveX; var y = e.clientY - moveY; if ( x > 0 && && y > 0 && { box.style.left = x

function getCoordinate{/*收获光标的坐标*/ var x = evt.clientX; var y = evt.clientY; document.getElementById.innerHTML = x +' &' + y;}

复制代码 代码如下:function addBookMark{//将网页增加到收藏addBookMark(window.location,document.title卡塔尔(قطر‎if{ window.external.addFavorite; }else if { window.sidebar.addPanel; }else{ alert; }}

boxMove{ objMask = document.createElement; objMask.className = "BoxMask"; htmlRoot.appendChild; objMask.style.cssText += 'position:absolute;top:0; left:0;filter:Alpha;opacity:0.5;background:#AAA;'; objMask.style.zIndex = z_index -1; objMask.style.width = htmlRoot.clientWidth + 'px'; objMask.style.height = htmlRoot.scrollHeight + htmlRoot.scrollTop + 'px'; } $.click{ showBox.hide(); mybg.style.display = "none"; }); $.click = function; mybg.style.display = "none"; };

function bubbleSort{/*冒泡排序法*/var sign = false // 最早化换个地方标识为假for(var i=0; i < arr.length-1; i++卡塔尔国{ for(varj=0; j < arr.length-1-i; j++State of Qatar{ if{ vartemp = arr[j] arr[j]= arr[j+1] arr[j+1]= temp sign= true // 若当前那黄金时代圈相比较中,有过交换一下地方,则置换个地方标识为真 } } if// 判定当前那意气风发圈有过换个方式否… sign= false // 有过换个地方,则重新设置换个地点标识为假 else break// 未有,则甘休 }return arr;}

//定义js错误管理函数onerror = errHandle;function errHandle{ var txt="" txt = "本页中有不当!nn" txt += "错误: "+ msg +"n" txt += "地址: "

function setHomepage {// setHome(this, window.location卡塔尔 try { obj.style.behavior = 'url'; obj.setHomePage { if { try { netscape.security.PrivilegeManager.enablePrivilege; } catch { alert('此操作被浏览器谢绝!n请在浏览器地址栏输入"about:config"并回车n然后将 [signed.applets.codebase_principal_support]的值设置为"true",双击就可以。'卡塔尔国; } var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); prefs.setCharPref('browser.startup.homepage', vrl); } } }

本文由澳门新莆京娱乐官网发布于服务器与运维,转载请注明出处:实用函数的使用详解_javascript技巧_脚本之家澳门新莆京娱乐官网

关键词: