google廣告之另類js調(diào)用實(shí)現(xiàn)代碼
今天發(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)!
相關(guān)文章:
1. python實(shí)現(xiàn)讀取類別頻數(shù)數(shù)據(jù)畫(huà)水平條形圖案例2. python中PyQuery庫(kù)用法分享3. python操作數(shù)據(jù)庫(kù)獲取結(jié)果之fetchone和fetchall的區(qū)別說(shuō)明4. Ajax實(shí)現(xiàn)頁(yè)面無(wú)刷新留言效果5. PHP獲取時(shí)間戳等相關(guān)函數(shù)匯總6. JSP+Servlet實(shí)現(xiàn)文件上傳到服務(wù)器功能7. 阿里前端開(kāi)發(fā)中的規(guī)范要求8. 關(guān)于HTML5的img標(biāo)簽9. CSS3實(shí)現(xiàn)動(dòng)態(tài)翻牌效果 仿百度貼吧3D翻牌一次動(dòng)畫(huà)特效10. ASP中解決“對(duì)象關(guān)閉時(shí),不允許操作。”的詭異問(wèn)題……
