【发布时间】:2018-07-09 23:19:59
【问题描述】:
我正在制作一个包含按钮的 HTA 应用程序,我希望按钮在单击时交替显示颜色(例如橙色/绿色),我找到了一个与 .html 扩展名一起使用的脚本,但在出现脚本错误时使用 .hta 扩展名运行。请告诉如何修复。 (是的,我需要坚持使用 hta)
注意,这是HTML Application,如果下面的代码在标准浏览器中运行,它就可以正常工作
JS
jQuery(function($) {
$('.select').click(function() {
$(this).toggleClass('highlight')
})
})
CSS
.select {
background: rgb(255, 145, 0);
}
.select.highlight {
background: rgb(26, 255, 0);
}
HTML
<body>
<input type="button" name="Ignore Select" value="Ignore Select" id="select" class="select" />
<input type="button" name="Ignore Delete" value="Ignore Delete" id="select1" class="select" />
<input type="button" name="Ignore Insert" value="Ignore Insert" id="select2" class="select" />
<input type="button" name="Ignore Update" value="Ignore Update" id="select3" class="select" />
<input type="button" name="Ignore Sleep" value="Ignore Sleep" id="select4" class="select" />
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="my.js"></script>
编辑:错误图像,https://imgur.com/a/ex0mw9P
【问题讨论】:
-
脚本错误是什么?
-
@LGSon 正如您从这个 OP 的 HTML 中看到的那样,他的脚本已经在
body之后(而且他有jQuery(function($) {反正) -
@user473470 这不是错误,这只是资源的 URL。 实际错误是什么?
标签: javascript html css button hta