我如何通过单击html按钮执行脚本? [英] How can i execute a script from a click of a html button?

查看:1074
本文介绍了我如何通过单击html按钮执行脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过单击网页上的html按钮来执行脚本?

how can i execute a script from a click of a html button on a web page?

推荐答案

方法如下:
http://www.w3schools.com/jsref/event_onclick.asp [ http://api.jquery.com/click/ [
This is how:
http://www.w3schools.com/jsref/event_onclick.asp[^],
or, with jQuery:
http://api.jquery.com/click/[^].

—SA


此处:
<input type="button" id="ClickToRunJS" onclick="CallJS();" />


function CallJS()
{
   alert("OnClick on a HTML button was triggered!!!");
}


这篇关于我如何通过单击html按钮执行脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆