0
我想做一個Chrome擴展。而且我無法更改div中的文字。你能幫我嗎?我找不到這裏有什麼問題。不能document.getElementById(「page」)。innerHTML
manifest.json的:
{
"name": "Test",
"version": "0.0.1",
"description": "Test app",
"permissions": [ "background", "tts", "storage" ],
"background": { "scripts": ["my.js"] },
"browser_action": {
"default_popup": "my.html"
},
"manifest_version": 2
}
my.js:
function StartUp(){
var data ="dater";
document.getElementById("page").innerHTML = data;
}
my.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test app</title>
<script src="my.js"></script>
</head>
<body>
<div id="page" onclick="StartUp()">
hello
</div>
</body>
</html>
之前''