我正在为 Chrome 创建一个扩展程序。我想在用户单击按钮时执行脚本。这是我当前 html 文件中的代码
<input type="button" id ="button" onclick='notEmpty()' value="Play"/>
notEmpty()
位于 JavaScript (.js) 文件中。如何在 notEmpty()
函数中执行另一个脚本?
最佳答案
我还没有为 chrome 编写扩展,但对于典型的 javascript,您可以执行以下操作之一。
<script type="text\javascript">
function notEmpty()
{
someOtherFunction();
}
</script>
或
<input type="button" id ="button" onclick='notEmpty(); someOtherFunction();' value="Play"/>
关于google-chrome - 当用户单击按钮时如何执行 JavaScript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4549690/