首页 > 解决方案 > 关于谷歌扩展的简单初学者问题

问题描述

所以我是一个初学者,我想创建一个谷歌扩展程序,我已经解决了,但是当我在谷歌浏览器上打开它时,事件似乎不起作用,按钮根本不起作用,我试过了很多故障排除。下面是包含 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);
});

标签: javascriptgoogle-chrome-extension

解决方案


推荐阅读