js引入、注释、事件

1.引入方式
1.<script>
alert(123)
var x,y; #函数变量
x=12;
y=55
alert(x);
console.log(y);
</script>
2.<script src="文件名.js"></script>
2.助释方法//
3.if方法:if(a<b){}:在括号里面
4.函数function s(){
var he="你好";#变量
docment.write(“汉子”)#控制HTML
}
console.log(s());
5.数据类型
基本数据类型:number,null,string,undefined,bolean
引用数据类型:objcet

6.事件HTML

7.字符串方法
length返回字符串的长度
indexOf()查找字符串的字符串
lastIndexOf()返回指定文本字符串最后一次出现的索引
indexOx()同上
search()查找字符串的位置
提取部分字符串
slice(开始,结束)
substring(开始,结束)
substr(开始,结束)
toUpperCase()字母小写变大写
toLowerCase()字母大写变小写
concat()连接字符串

猜你喜欢

转载自www.cnblogs.com/cui00/p/12347728.html