做的网站没流量吗,制作简单网页教程,海南自贸港跨境电商怎么做,项目名称1、js输出#xff1a;console.log(hellowworld);
2、变量定义#xff1a;var#xff0c;变量名区分大小写
3、数据类型#xff1a;
基本数据类型#xff1a;number#xff08;整数浮点数#xff0c;NaN非数#xff0c;正负无穷大#xff09;。boolean。…1、js输出console.log(hellowworld);
2、变量定义var变量名区分大小写
3、数据类型
基本数据类型number整数浮点数NaN非数正负无穷大。boolean。undedined。null。string引用数据类型JS对象内置对象和自定义对象
4、强制类型转换Number123将字符串123转为数字 Nubber细分parseIntparseFloat
5、自定义对象var item new Object();
或者var item { 对象内容}
6、获取整个对象var ele Document.getElementById/Name/...
7、获取对象后可以获取属性值var attr ele.getAttribute(class); 判断是否存在var flag ele.hasAttribute(class);
设置或添加ele.setAttribute(name,aaa);
移除 ele.removeAttribute(class);
8、元素内容操作ele.innerHTML span新内容/span ele.innerText 新内容只包含文本
9、通过父子结点相互查找ele ele2.parentNode; ele ele2.children;循环可访问所有
10、创建元素var p document.createElement(p); p.innerText 内容; 插入ele.appendChild(p); 插入位置可控。
11、删除结点元素找到父元素删掉子元素
parent.removeChild(father);