js编程

js语言_常用命令_笔记

2023-11-26  本文已影响0人  zip11

// if
if (condition) {
如果 condition 为 true 执行该代码块
} else {
如果 condition 为 false 执行该代码块
}

// 遍历数组
// https://zhuanlan.zhihu.com/p/112006700
// for...of 方法 (ES6)

var arr = ['a','b','c'];
for(let item of arr) {
console.log(item);
}

// 按钮数组—添加监听器
// https://blog.csdn.net/tuzi007a/article/details/114275538

// 监听器 修改 点击事件
function od()
{
alert("我改变方法了。");
}
function of()
{
document.getElementById('name').onclick = function(){
od();
};

// js 选择器
https://www.cnblogs.com/codingcc1/p/11073083.html

// js下载文件
https://juejin.cn/post/7226722753667235901

上一篇 下一篇

猜你喜欢

热点阅读