久久r热视频,国产午夜精品一区二区三区视频,亚洲精品自拍偷拍,欧美日韩精品二区

您的位置:首頁技術(shù)文章
文章詳情頁

google廣告之另類js調(diào)用實(shí)現(xiàn)代碼

瀏覽:145日期:2024-04-24 15:16:03

今天發(fā)現(xiàn)一個(gè)google廣告的另類調(diào)用方法

function addGoogel (content, obj) { addScript(’//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js’, function () { var ins = document.createElement(’ins’) ins.setAttribute(’class’, ’adsbygoogle’) ins.setAttribute(’data-ad-client’, ’ca-pub-******’) ins.setAttribute(’style’, obj.style) ins.setAttribute(’data-ad-slot’, obj.slot) content.appendChild(ins) var inlineScript = document.createElement(’script’) inlineScript.type = ’text/javascript’ inlineScript.text = ’(adsbygoogle = window.adsbygoogle || []).push({});’ document.getElementsByTagName(’body’)[0].appendChild(inlineScript) })}

調(diào)用方法

window.onload = function () { var line = document.getElementById(’ad_line’), // 橫幅 area = document.getElementById(’ad_area’)// 矩陣 if (!isYd()) { // 不為移動(dòng)端 if (line) { //橫幅 addGoogel(line, { style: ’display:inline-block;width:1100px;height:160px’, slot: ’6183651273’ }) } if (area) { //矩形 addGoogel(area, { style: ’display:inline-block;width:250px;height:250px’, slot: ’1995310048’ }) } }}

到此這篇關(guān)于google廣告之另類js調(diào)用實(shí)現(xiàn)代碼的文章就介紹到這了,更多相關(guān)js google廣告內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!

標(biāo)簽: JavaScript
相關(guān)文章:
主站蜘蛛池模板: 大兴区| 禹州市| 衢州市| 湖北省| 镶黄旗| 铜山县| 平邑县| 开封县| 瑞安市| 灌阳县| 东港市| 商河县| 鹿邑县| 喀喇沁旗| 克什克腾旗| 五寨县| 克拉玛依市| 万年县| 安义县| 四会市| 西贡区| 驻马店市| 郧西县| 怀仁县| 万山特区| 云和县| 西乡县| 延川县| 临江市| 沂南县| 明水县| 怀宁县| 陇川县| 南丹县| 剑阁县| 绥中县| 陆丰市| 米林县| 嘉禾县| 邵武市| 万盛区|