[英]Button doesn't work and change the border color
I tried to code a little Firefox Extension but I don't get the Button in the popup working.我试图编写一个小的 Firefox 扩展,但我没有让弹出窗口中的按钮工作。 What should happen when you click the button is that the red border changes into a green one.
当您单击该按钮时,红色边框会变为绿色边框。 I couldn't find the mistake.
我找不到错误。
This is my manifest.json这是我的 manifest.json
{
"manifest_version": 2,
"name": "Testing",
"version": "1.0",
"description": "Testing",
"icons": {
"48": "icon.jpg"
},
"content_scripts": [
{
"matches": ["*://*.allee-abi20.de/*"],
"js": ["ust.js"]
}
],
"permissions": [
"activeTab",
"contextMenus"
],
"browser_action": {
"default_icon": "icon.jpg",
"default title": "Hallo",
"default_popup": "view.html"
}
}
Thats the view.html这就是view.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<link rel="stylesheet" href = "style.css" type="text/css"/>
</head>
<body>
<input type=text id="Kat"></input>
<input type=text id="Ty"></input>
<button id= "but">Klicken </button>
<script type="text/javascript" src="./popup.js"></script>
</body>
</html>
And thats the popup.js这就是 popup.js
document.body.style.border = "5px solid red";
var myLink = document.getElementById("But");
myLink.onclick = function(){
document.body.style.border = "20px solid green";
}
只是一个关于大写的小语法问题:写but
,而不是But
,因为But
是undefined 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.