JS基础/未完成

本文介绍了HTML、CSS和JavaScript的基础语法,涵盖了数据类型、运算符、数组、函数等内容,并详细讲解了DOM的基本操作,包括元素的选择、创建、删除、样式设置等。

HTML+CSS+JS
alert();
confirm();

基础语法:与C#一致
数据类型及类型转换
var (string,decimal)
parseInt()
parseFloat();
isNaN();

运算符:
数学运算符:+ - * /  ++ --   %
关系运算符:== != >= <= > <
逻辑运算符:&&   ||   !
其他运算符:+= -= *= /=  ?:

语句
分支语句,循环语句

数组:Array();
函数:function
funciton 函数名(a)
{
    return ??;
}

Dom操作
var a =document.getElementById();
var b =document.getElementsByClassName();
document.getElementsByName();
document.getElementsByTagName();

window.open('','_blank');
window.close();
window.opener  -  返回的是一个窗口对象
window.setInterval(function(){},2000);
window.setTimeout(funciton(){},2000);
window.clearInterval();
window.scrollTo(x,y);

window.history.go(-1);

window.location.href="url"; - 当前页面跳转
var a = window.location.href; - 获取当前页面地址

操作元素的样式
a.style.backgroundColor = "red";
a.style.width="10px";

a.offsetTop/Left/Width/Height - 实时数据

操作元素的内容
表单元素 - value
非表单元素 - innerHTML   innerText

操作元素的属性
setAttribute('','');
getAttribute('');
removeAttribute('');

创建及删除元素
对象.innerHTML= "标记拼好的字符串";
-----------------
var a = document.createElement('div');
a.setAttribute('class', 'div2');
document.getElementById('div1').appendChild(a);
-----------------
对象.parentNode.removeChild(对象);

获取相关元素
获取对象父级
对象.parentNode
获取对象子级
对象.childNodes
获取哥哥
对象.previousSibling - 注意!!!
或取弟弟
对象.nextsibling - !!!

字符串操作  数学操作

时间日期

onclick
onmouseover/onmouseout
onfocus/onblur
onkeyup



ondblclick








转载于:https://www.cnblogs.com/buzhiheyan/p/8086617.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值