亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Javascript 小技巧全集第2/4頁(yè)

 更新時(shí)間:2006年06月19日 00:00:00   作者:  

//各種尺寸

s  +=  "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域?qū)挘?+  document.body.clientWidth;  
s  +=  "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域高:"+  document.body.clientHeight;  
s  +=  "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域高:"+  document.body.offsetWeight  +"  (包括邊線的寬)";  
s  +=  "\r\n網(wǎng)頁(yè)可見(jiàn)區(qū)域高:"+  document.body.offsetHeight  +"  (包括邊線的寬)";  
s  +=  "\r\n網(wǎng)頁(yè)正文全文寬:"+  document.body.scrollWidth;  
s  +=  "\r\n網(wǎng)頁(yè)正文全文高:"+  document.body.scrollHeight;  
s  +=  "\r\n網(wǎng)頁(yè)被卷去的高:"+  document.body.scrollTop;  
s  +=  "\r\n網(wǎng)頁(yè)被卷去的左:"+  document.body.scrollLeft;  
s  +=  "\r\n網(wǎng)頁(yè)正文部分上:"+  window.screenTop;  
s  +=  "\r\n網(wǎng)頁(yè)正文部分左:"+  window.screenLeft;  
s  +=  "\r\n屏幕分辨率的高:"+  window.screen.height;  
s  +=  "\r\n屏幕分辨率的寬:"+  window.screen.width;  
s  +=  "\r\n屏幕可用工作區(qū)高度:"+  window.screen.availHeight;  
s  +=  "\r\n屏幕可用工作區(qū)寬度:"+  window.screen.availWidth;  

//過(guò)濾數(shù)字

<input type=text onkeypress="return event.keyCode>=48&&event.keyCode<=57||(this.value.indexOf('.')<0?event.keyCode==46:false)" onpaste="return !clipboardData.getData('text').match(/\D/)" ondragenter="return false">

 

//特殊用途

<input type=button value=導(dǎo)入收藏夾 onclick="window.external.ImportExportFavorites(true,'http://localhost');">
<input type=button value=導(dǎo)出收藏夾 onclick="window.external.ImportExportFavorites(false,'http://localhost');">
<input type=button value=整理收藏夾 onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)">
<input type=button value=語(yǔ)言設(shè)置   onclick="window.external.ShowBrowserUI('LanguageDialog', null)">
<input type=button value=加入收藏夾 onclick="window.external.AddFavorite('http://www.google.com/', 'google')">
<input type=button value=加入到頻道 onclick="window.external.addChannel('http://www.google.com/')">
<input type=button value=加入到頻道 onclick="window.external.showBrowserUI('PrivacySettings',null)">

 

//不緩存

<META HTTP-EQUIV="pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache, must-revalidate">
<META HTTP-EQUIV="expires" CONTENT="0">

 


//正則匹配

匹配中文字符的正則表達(dá)式: [\u4e00-\u9fa5]
匹配雙字節(jié)字符(包括漢字在內(nèi)):[^\x00-\xff]
匹配空行的正則表達(dá)式:\n[\s| ]*\r
匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*<\/\1>|<(.*) \/>/ 
匹配首尾空格的正則表達(dá)式:(^\s*)|(\s*$)(像vbscript那樣的trim函數(shù))
匹配Email地址的正則表達(dá)式:\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*
匹配網(wǎng)址URL的正則表達(dá)式:http://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?
以下是例子:
利用正則表達(dá)式限制網(wǎng)頁(yè)表單里的文本框輸入內(nèi)容:
用正則表達(dá)式限制只能輸入中文:onkeyup="value=value.replace(/[^\u4E00-\u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\u4E00-\u9FA5]/g,''))"
1.用正則表達(dá)式限制只能輸入全角字符: onkeyup="value=value.replace(/[^\uFF00-\uFFFF]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\uFF00-\uFFFF]/g,''))"
2.用正則表達(dá)式限制只能輸入數(shù)字:onkeyup="value=value.replace(/[^\d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
3.用正則表達(dá)式限制只能輸入數(shù)字和英文:onkeyup="value=value.replace(/[\W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"

//消除圖像工具欄

<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="false"
or
<head>
<meta http-equiv="imagetoolbar" content="no">
</head>

 

 

//無(wú)提示關(guān)閉

function Close()
{
 var ua=navigator.userAgent
 var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
 if(ie)
 {
      var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
  if(IEversion< 5.5)
  {
   var str  = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
       str += '<param name="Command" value="Close"></object>';
       document.body.insertAdjacentHTML("beforeEnd", str);
       document.all.noTipClose.Click();
  }
      else
  {
       window.opener =null;
       window.close();
      }
   }
 else
 {
  window.close()
   }
}

 

//取得控件得絕對(duì)位置(1)

<script language="javascript"
function getoffset(e)

 var t=e.offsetTop; 
 var l=e.offsetLeft; 
 while(e=e.offsetParent)
 { 
  t+=e.offsetTop; 
  l+=e.offsetLeft; 
 } 
 var rec = new Array(1);
 rec[0]  = t;
 rec[1] = l;
 return rec

</script>

//獲得控件的絕對(duì)位置(2)

 

oRect = obj.getBoundingClientRect();
oRect.left
oRect.

//最小化,最大化,關(guān)閉

<object id=min classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
<param name="Command" value="Minimize"></object> 
<object id=max classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
<param name="Command" value="Maximize"></object> 
<OBJECT id=close classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"
<PARAM NAME="Command" value="Close"></OBJECT> 
<input type=button value=最小化 onclick=min.Click()> 
<input type=button value=最大化 onclick=max.Click()> 
<input type=button value=關(guān)閉 onclick=close.Click()> 

 

//光標(biāo)停在文字最后

<script language="javascript">
function cc()
{
 var e = event.srcElement;
 var r =e.createTextRange();
 r.moveStart('character',e.value.length);
 r.collapse(true);
 r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">

 

//頁(yè)面進(jìn)入和退出的特效

進(jìn)入頁(yè)面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
推出頁(yè)面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)"
這個(gè)是頁(yè)面被載入和調(diào)出時(shí)的一些特效。duration表示特效的持續(xù)時(shí)間,以秒為單位。transition表示使
用哪種特效,取值為1-23:
  0 矩形縮小 
  1 矩形擴(kuò)大 
  2 圓形縮小
  3 圓形擴(kuò)大 
  4 下到上刷新 
  5 上到下刷新
  6 左到右刷新 
  7 右到左刷新 
  8 豎百葉窗
  9 橫百葉窗 
  10 錯(cuò)位橫百葉窗 
  11 錯(cuò)位豎百葉窗
  12 點(diǎn)擴(kuò)散 
  13 左右到中間刷新 
  14 中間到左右刷新
  15 中間到上下
  16 上下到中間 
  17 右下到左上
  18 右上到左下 
  19 左上到右下 
  20 左下到右上
  21 橫條 
  22 豎條 
  23 

相關(guān)文章

最新評(píng)論