• <fieldset id="8imwq"><menu id="8imwq"></menu></fieldset>
  • <bdo id="8imwq"><input id="8imwq"></input></bdo>
    最新文章專題視頻專題問答1問答10問答100問答1000問答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
    問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
    當(dāng)前位置: 首頁 - 科技 - 知識百科 - 正文

    JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼

    來源:懂視網(wǎng) 責(zé)編:小采 時間:2020-11-27 22:28:38
    文檔

    JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼

    JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼: div調(diào)用函數(shù)跳轉(zhuǎn): var obj = document.getElementById('id'); obj.onclick=function(){ window.location.href=跳轉(zhuǎn)的地址 rel=external nofollow ; } 源文件: <!DOCTYPE html> <html>
    推薦度:
    導(dǎo)讀JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼: div調(diào)用函數(shù)跳轉(zhuǎn): var obj = document.getElementById('id'); obj.onclick=function(){ window.location.href=跳轉(zhuǎn)的地址 rel=external nofollow ; } 源文件: <!DOCTYPE html> <html>

     div調(diào)用函數(shù)跳轉(zhuǎn):

    var obj = document.getElementById('id');
    obj.onclick=function(){ 
     window.location.href="跳轉(zhuǎn)的地址" rel="external nofollow" ; 
     }

    源文件:

    <!DOCTYPE html>
    <html>
    <head>
     <title>首頁推薦頁面</title>
     <meta name="author" content="Chunna.zheng"/>
     <meta http-equiv="CONTENT-TYPE" content="text/html; charset=utf-8"/>
     <style type="text/css">
     div.recommendclass {
     width: 100%;
     height: 60px;
     line-height: 60px;
     vertical-align: middle;
     font-size: 18px;
     text-align: center; /*文字水平居中對齊*/
     background-color: #f5f5f5;
     }
     .mall_contentChild1Class {
     display: inline;
     width: 40%;
     height: 100px;
     background-color: #f5f5f5;
     }
     .mall_contentChild2Class {
     display: inline;
     width: 60%;
     height: 100px;
     float: right;
     position: relative;
     background-color: #f5f5f5;
     }
     .mall_contentChild2BottomClass {
     display: table-cell;
     width: 90%;
     vertical-align: bottom;
     position: absolute;
     left: 5px;
     bottom: 5px;
     background-color: #f5f5f5;
     }
     .mall_Child2TextLeftClass {
     line-height: 16px;
     vertical-align: bottom;
     background-color: #f5f5f5;
     }
     .mall_Child2TextRightClass {
     float: right;
     color: #f3b041;
     font-size: 25px;
     line-height: 26px;
     vertical-align: bottom;
     background-color: #f5f5f5;
     }
     .news_title {
     display: block;
     font-size: 18px;
     vertical-align: center;
     background-color: #f5f5f5;
     }
     .news_message {
     display: block;
     font-size: 14px;
     vertical-align: center;
     background-color: #f5f5f5;
     }
     .news_time {
     display: block;
     font-size: 12px;
     vertical-align: bottom;
     position: absolute;
     bottom: 5px;
     right: 5px;
     background-color: #f5f5f5;
     }
     </style>
    </head>
    <body style="margin: 0; padding: 0 ">
    <div id="mall_news" class="recommendclass">新聞咨訊</div>
    <div id="news_content" style="background-color:#f5f5f5"></div>
    <script>
     var Shu = 2;
     var df = document.createElement("div");
     for (var i = 0; i <= Shu; i++) {
     var oDiv = document.createElement("div");
     var divChild1 = document.createElement("div");
     divChild1.className = 'mall_contentChild1Class';
     var img = document.createElement("img");
     img.style.width = "130px";
     img.style.height = "100px";
     img.src = 'ic_mall_good_stuff.jpg';
     divChild1.appendChild(img);
     oDiv.appendChild(divChild1);
     var divChild2 = document.createElement("div");
     divChild2.className = 'mall_contentChild2Class';
     var text1 = document.createElement("span");
     text1.className = 'news_title';
     text1.innerHTML = "我是標(biāo)題";
     divChild2.appendChild(text1);
     var bottomDiv = document.createElement("div");
     var textLeft = document.createElement("span");
     textLeft.className = 'news_message';
     textLeft.innerHTML = "我是內(nèi)容";
     bottomDiv.appendChild(textLeft);
     var textRight = document.createElement("span");
     textRight.className = 'news_time';
     textRight.innerHTML = "2017.09.23";
     bottomDiv.appendChild(textRight);
     divChild2.appendChild(bottomDiv);
     oDiv.appendChild(divChild2);
     //添加點擊事件
     oDiv.onclick = function(){
     window.location.href="file:///android_asset/news.html" rel="external nofollow" ;
     }
     df.appendChild(oDiv);
     }
     document.getElementById("news_content").appendChild(df);
    </script>
    </body>
    </html>

    總結(jié)

    以上所述是小編給大家介紹的JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對腳本之家網(wǎng)站的支持!

    聲明:本網(wǎng)頁內(nèi)容旨在傳播知識,若有侵權(quán)等問題請及時與本網(wǎng)聯(lián)系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

    文檔

    JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼

    JS動態(tài)添加的div點擊跳轉(zhuǎn)到另一頁面實現(xiàn)代碼: div調(diào)用函數(shù)跳轉(zhuǎn): var obj = document.getElementById('id'); obj.onclick=function(){ window.location.href=跳轉(zhuǎn)的地址 rel=external nofollow ; } 源文件: <!DOCTYPE html> <html>
    推薦度:
    標(biāo)簽: 頁面 點擊 js
    • 熱門焦點

    最新推薦

    猜你喜歡

    熱門推薦

    專題
    Top
    主站蜘蛛池模板: 久久精品国产半推半就| 国产精品无码永久免费888| 97精品国产97久久久久久免费| 中文精品99久久国产 | 国产精品视频白浆免费视频| 久久93精品国产91久久综合| www.亚洲精品| 亚洲国产精品一区二区第一页| 精品国产成人在线| 成人精品一区二区三区电影黑人| 99精品在线播放| 国产国产精品人在线视| 四虎国产精品永久在线观看| 亚洲国产精品综合久久一线| 国产精品欧美久久久久无广告| 精品久久久久久久久中文字幕| 国产午夜精品一区二区三区漫画| 无码人妻精品中文字幕免费| 日韩熟女精品一区二区三区| 国产精品无码一区二区在线观一| 2023国产精品自拍| 欧美黑人巨大精品| 久久国产精品国产自线拍免费| 精品久久久久久久久午夜福利| 亚洲日韩精品无码一区二区三区| 欧美精品整片300页| 久99久无码精品视频免费播放| 国内精品久久久久国产盗摄 | 99re这里只有精品6| 四虎影院国产精品| 亚洲精品成人久久久| 国产精品亚洲精品日韩已方| 国产成人精品无人区一区| 91精品婷婷国产综合久久| 国产精品55夜色66夜色| 国产精品视频久久久| 久久精品国产一区二区三区日韩| 国产一成人精品福利网站| 久久青青草原精品影院| 四虎国产精品免费久久久| 87国产私拍福利精品视频|