3_Event

JS Tutorial For TrySky IT Center (Operation and Maintenance Center)

Written by Zhang Zhihong in 2021

Event

Event mean somethings happen in html, such as click, rolling, The HTML page is loaded, Input fields in HTML change, etc…

Usually, there are things you can do when the event happens.You have saw the event before.Well…when I talked about function.

Here, onclick is a event in fact.

<button onclick="buttonFunction('Zhang','poet')">
        I am a button.
</button>

So, let me show you how to use event now.

<!DOCTYPE html>
<html lang="en">
<head>...
</head>
<body>
    <button onclick="getElementById('demo').innerHTML=Date() ">现在的时间是:</button>
    <p id="demo"></p>
</body>
</html>

In the code above, I define a event “onclick”, when a click on the button, it will find the id “demo”, and change the contents of the label where the ID is located.

The results:
在这里插入图片描述

Obviously, it is a good practice to write functions in JS files.

<!DOCTYPE html>
<html lang="en">
<head>...
</head>
<body>
    <button onclick="myDate()">现在的时间是:</button>
    <p id="demo"></p>
</body>
<script src="poem4.js"></script>
</html>

Here, I declare a function “myDate”, and use it in HTML.

function myDate() {
    document.getElementById("demo").innerHTML = Date()
}

The result is the same as above.

In these example, we can change the content by ID. We also can use “this” to change the content of itself.

Here mean when I click on the button, the text inside the button will be “I am not a button”

<!DOCTYPE html>
<html lang="en">
<head>...
</head>
<body>
    <button onclick="this.innerHTML='I am not a button'">
    I am a button
    </button>
</body>
</html>

Result

在这里插入图片描述

Here is a list of some common events:

在这里插入图片描述

2021.1.18.by zhang

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
这段代码定义了一个名为 `dwc3_notify_event` 的枚举类型,用于表示 DWC3(DesignWare USB 3.0 超级速度 USB 控制器)的不同通知事件。这些事件用于在 DWC3 控制器的驱动程序中进行事件处理和通信。 下面是每个枚举值的含义和可能的用途: - `DWC3_CONTROLLER_ERROR_EVENT`:表示控制器错误事件,用于处理控制器发生错误的情况。 - `DWC3_CONTROLLER_RESET_EVENT`:表示控制器复位事件,用于处理控制器复位操作。 - `DWC3_CORE_PM_SUSPEND_EVENT`:表示核心挂起事件,用于处理 USB 核心的挂起操作。 - `DWC3_CORE_PM_RESUME_EVENT`:表示核心恢复事件,用于处理 USB 核心的恢复操作。 - `DWC3_CONTROLLER_CONNDONE_EVENT`:表示连接完成事件,用于处理 DWC3 控制器连接完成后的操作。 - `DWC3_CONTROLLER_NOTIFY_OTG_EVENT`:表示 OTG(On-The-Go)通知事件,用于处理 OTG 相关的通知。 - `DWC3_CONTROLLER_SET_CURRENT_DRAW_EVENT`:表示设置当前电流消耗事件,用于设置 DWC3 控制器的当前电流消耗。 - `DWC3_CONTROLLER_NOTIFY_DISABLE_UPDXFER`:表示禁用更新传输事件,用于禁用传输更新。 - `DWC3_CONTROLLER_PULLUP`:表示上拉事件,用于处理 USB 接口的上拉操作。 此外,还有一些与 USB GSI(Generic SuperSpeed Inter-Chip)事件缓冲区相关的通知事件: - `DWC3_GSI_EVT_BUF_ALLOC`:表示事件缓冲区分配事件。 - `DWC3_GSI_EVT_BUF_SETUP`:表示事件缓冲区设置事件。 - `DWC3_GSI_EVT_BUF_CLEANUP`:表示事件缓冲区清理事件。 - `DWC3_GSI_EVT_BUF_CLEAR`:表示事件缓冲区清除事件。 - `DWC3_GSI_EVT_BUF_FREE`:表示事件缓冲区释放事件。 最后,`DWC3_CONTROLLER_NOTIFY_CLEAR_DB` 表示清除数据包通知。 这些枚举值用于在 DWC3 控制器的驱动程序中标识和处理不同的通知事件。具体的使用和含义可能因驱动程序实现和配置而有所不同,需要查阅相关的文档或源代码来了解其具体用法和上下文。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值