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

Chrome擴(kuò)展頁面動(dòng)態(tài)綁定JS事件提示錯(cuò)誤

 更新時(shí)間:2014年02月11日 10:08:53   作者:  
開發(fā)Chrome擴(kuò)展時(shí),頁面的popup.html中需要js的時(shí)候,直接將JS寫在動(dòng)態(tài)綁定JS事件會(huì)提示錯(cuò)誤,下面有個(gè)不錯(cuò)的解決方法,大家可以參考下
問題描述:

當(dāng)開發(fā)Chrome擴(kuò)展時(shí),頁面的popup.html中需要js的時(shí)候,直接將JS寫在動(dòng)態(tài)綁定JS事件會(huì)提示:

Refused to execute inline script because it violates the following Content Security Policy directive: “script-src ‘self' chrome-extension-resource:”..

解決辦法:

在popup.html中引用外部的js文件動(dòng)態(tài)綁定JS事件,例如:
復(fù)制代碼 代碼如下:

<script type="text/javascript" charset="utf-8" src='test.js'></script>

test.js中:
復(fù)制代碼 代碼如下:

var listbox = document.getElementById("showlist");
listbox.onclick=function(){
document.getElementById("player_sidebar").style.width = 100;
}

相關(guān)文章

最新評(píng)論