我正在尝试使用HTML按钮来调用JavaScript函数.
这是代码:
<input type="button" value="Capacity Chart" onclick="CapacityChart();">
Run Code Online (Sandbox Code Playgroud)
但它似乎无法正常工作.有一个更好的方法吗?
这是链接:http://projectpath.ideapeoplesite.com/bendel/toolscalculators.html点击左下方的容量选项卡.如果值未更改,则按钮应生成警报,如果输入值,则应生成图表.
我正在尝试为网站制作用户脚本以添加自定义表达.但是,我遇到了很多错误.
这是功能:
function saveEmotes() {
removeLineBreaks();
EmoteNameLines = EmoteName.value.split("\n");
EmoteURLLines = EmoteURL.value.split("\n");
EmoteUsageLines = EmoteUsage.value.split("\n");
if (EmoteNameLines.length == EmoteURLLines.length && EmoteURLLines.length == EmoteUsageLines.length) {
for (i = 0; i < EmoteURLLines.length; i++) {
if (checkIMG(EmoteURLLines[i])) {
localStorage.setItem("nameEmotes", JSON.stringify(EmoteNameLines));
localStorage.setItem("urlEmotes", JSON.stringify(EmoteURLLines));
localStorage.setItem("usageEmotes", JSON.stringify(EmoteUsageLines));
if (i == 0) {
console.log(resetSlot());
}
emoteTab[2].innerHTML += '<span style="cursor:pointer;" onclick="appendEmote(\'' + EmoteUsageLines[i] + '\')"><img src="' + EmoteURLLines[i] + '" /></span>';
} else {
alert("The maximum emote(" + EmoteNameLines[i] + ") size is (36x36)");
} …Run Code Online (Sandbox Code Playgroud)