日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
前端開發(fā)中這些小技巧,你知道幾個?

瀏覽器地址欄運行JavaScript代碼

 
 
 
  1. javascript:alert('hello!');
  • Firefox不支持;
  • 其他瀏覽器必須手動輸入才可執(zhí)行;

瀏覽器地址欄運行HTML代碼

 
 
 
  1. data:text/html,

    Hello, world!

  • 在非IE瀏覽器可以運行

瀏覽器變成文本編輯器

地址欄輸入:

 
 
 
  1. data:text/html, 

控制臺輸入:

 
 
 
  1. document.body.contentEditable='true';

利用a標(biāo)簽自動解析URL

 
 
 
  1. var a = document.createElement('a');
  2. a.href = 'https://www.maomin.club';
  3. console.log(a.host); // www.maomin.club

頁面擁有ID的元素會創(chuàng)建全局變量

 
 
 
  1.  
  2. 我是內(nèi)容
  • 引用CDN文件時,不用HTTP標(biāo)識

     
     
     

    利用script標(biāo)簽保存任意信息

     
     
     

     在頁面中隱藏鼠標(biāo)

     
     
     
    1. *{
    2.     cursor: none!important;
    3. }

    文字模糊效果

     
     
     
    1. p {
    2.     color: transparent;
    3.     text-shadow: #111 0 0 5px;
    4. }

     實時編輯CSS

     
     
     
    1.  
    2.  
    3.   style{
    4.    display: block;
    5.   }
    6.  
    7.     
    8.          body { color: blue }
    9.     

    實現(xiàn)長寬比固定區(qū)域

     
     
     
    1.     
    2.         this content will have a constant aspect ratio that varies based on the width.
    3.     
  • 禁止他人使用iframe標(biāo)簽引用網(wǎng)址

     
     
     
    1. if (window.location != window.parent.location) window.parent.location = window.location;

    生成隨機字符串

     
     
     
    1. function generateRandomAlphaNum(len) {
    2.     var rdmString = "";
    3.     for (; rdmString.length < len; rdmString += Math.random().toString(36).substr(2));
    4.     return rdmString.substr(0, len);
    5. }

    浮點數(shù)轉(zhuǎn)化為整數(shù)

     
     
     
    1. console.log(~~1.2); // 1

    名稱欄目:前端開發(fā)中這些小技巧,你知道幾個?
    分享地址:http://www.5511xx.com/article/cdeopsg.html