javascript - 关于谷歌扩展的简单初学者问题
问题描述
所以我是一个初学者,我想创建一个谷歌扩展程序,我已经解决了,但是当我在谷歌浏览器上打开它时,事件似乎不起作用,按钮根本不起作用,我试过了很多故障排除。下面是包含 onEvent 的 background.js 文件的部分,而 onEvent 对我不起作用。
Java 脚本
// When Profit Button is clicked the program begins, and if a fee is inputed it will calculate with the fee. It will also
// calculate the shipping if you input a shipping
onEvent("findProfit", "click", function( ) {
setText("profitText", (getNumber("soldfor")) - getNumber("boughtfor"));
profit = getNumber("profitText");
fee = getText("feeInput");
shipping = getText("shippingInput");
if (fee != "") {
feeMultiplier = 1-(fee * 0.01);
setText("profitText", profit*feeMultiplier);
}
profit = getNumber("profitText");
if (shipping != "") {
setText("profitText", profit-shipping);
}
calculate();
BoughtFunction();
SoldFunction();
ProfitFunction();
updateScreen();
console.log(fee);
});
解决方案
推荐阅读
- javascript - Vue:如何在表单提交时将用户的注意力吸引到空字段:是否需要 if-else?
- javascript - 在浏览器上呈现页面时检测并防止更改链接
- node.js - 如何调试 docker restart 未在 node.js 应用程序中重新启动?
- kotlin - 如何为 Kotlin 中扩展函数抛出的异常提供自定义异常消息?
- angular - 角度获取完整路线
- angular - 显示来自二进制流的图像 - Angular 10
- nginx - Upstream解析为IPv6时Nginx连接失败
- mysql - 通过使用 MySQL 触发器检查 AFTER Update 语句中的 OLD 值来更新新值
- java - 如何将 http:namenode-ip:50070/conf XML 响应转换为 JSON 类型?
- c# - WCF:发送带有自定义标头的 SOAP 请求