东莞企业网站后缀,wordpress 移动模板,做网站的流程视频,网站如何提交百度收录变量声明#xff1a;使用var关键字#xff0c;变量没有类型#xff0c;但值有类型#xff08;弱类型语言#xff09;
数据类型#xff1a;
①number
②string#xff08;单引号#xff0c;双引号都可以表示字符串#xff09;
③boolean
④Object类型
⑤undefine…变量声明使用var关键字变量没有类型但值有类型弱类型语言
数据类型
①number
②string单引号双引号都可以表示字符串
③boolean
④Object类型
⑤undefined类型声明但未赋值的变量
比较运算符中与JAVA中不同的 等于只比较值有隐式转换
全等比较值和数据类型
函数①自定义函数 ②全局函数
语法 function functionName([arguments]) {alert(自定义函数);}
全局内置函数
parseInt(arg);参数arg转换为整数
parseFloat(arg);参数转换为Float类型数
eval(xxxxx);执行字符串内容可以当作js脚本运行
typeof();返回当前数值类型
alert(xxx);弹窗内容
console.log(a);控制台输出a
事件HTML中的常用事件调用js函数
onclic:单击事件
ondblclick双击事件
onblur失焦事件
onfocus聚焦事件
onmouseover移入事件
onmouseout移开事件
onload网页所有内容加载完自动执行一般放在body
onchange内容发生改变且光标失焦之后
!DOCTYPE html
htmlheadmeta charsetutf-8 /title/titlescriptfunction main() {console.log(自定义函数)}/script/head!-- 加载完页面加载 --body onloadmain()!-- 单击事件 --button typesubmit onclickmain()提交/buttonhr!-- 双击事件 --button typesubmit ondblclickmain()提交/buttonhr!-- 失焦事件 --textarea cols5 rows10 onblurmain()/textareahr!-- 聚焦事件 --textarea cols5 rows10 onfocusmain()/textareahr!-- 移入事件 --textarea cols5 rows10 onmouseovermain()/textareahr!-- 移出事件 --textarea cols5 rows10 onmouseoutmain()/textareahr!-- 更改保存事件 --textarea cols5 rows10 onchangemain()/textarea/body
/html
内置对象
string字符串
s.length
s.substring(开始位置结束位置1)
s.substr(开始位置截取长度);
s.split(;);分隔符
Array数组
string sArray.join();//连接数组转化为字符串
array.reverse();//反转数组
array.sort();//给数组排序需要传入自定义排序函数
!DOCTYPE html
htmlheadmeta charsetutf-8title/titlescriptvar s a b c d e f g h i j k l m n;console.log(s.length);console.log(s.split( ));console.log(s.substr(0, 3));console.log(s.substring(1, 3));var array [1, 2, 3, 9, 0];console.log(array);console.log(array.join());array.reverse();console.log(array);array.sort(array_sort);console.log(array);function array_sort(a, b) {return a - b;}var date new Date();console.log(date.getFullYear());console.log(date.getMonth());console.log(date.getDate());console.log(date.getHours());console.log(date.getTime());console.log(Math.PI);console.log(Math.sqrt(9));console.log(Math.floor(10.9));console.log(Math.ceil(9.1));/script/headbody/body
/html DOMdocument object model 使用步骤
1触发js
2js获得网页标签在js中每一个网页标签就是一个对象
通过document对象()
document文档对象
document.getElementById(div_id):通过id找到HTML标签。
可以精确获得网页中的某个标签。
js中所获得的网页中的标签对象称为DOM。
!DOCTYPE html
htmlheadmeta charsetutf-8title/titlescriptfunction oper() {var text1 document.getElementById(text1);// 获得text1标签对象var text2 document.getElementById(text2);// 获得text2标签对象console.log(text1.value)// 输出text1中的内容text2.value text1.value; //将text2框中内容变成text1内容text1.value ; //置空text1}function change(color) {var x document.getElementById(div1);// 获得div1对象x.style.height 100px;x.style.width 100px; //使用100px而不是100 pxx.style.backgroundColor color; // 一旦触发当前函数div1对象更改宽高颜色}/script/headbodyinput typetext value idtext1input typetext value idtext2button onclickoper()上传/buttondiv iddiv1div/divbutton idred onclickchange(red)红色/buttonbutton idyellow onclickchange(yellow)黄色/buttonbutton idpink onclickchange(pink)粉色/button/body
/html js操作标签体内容
obj.innerHTML
obj.innerText
!DOCTYPE html
htmlheadmeta charsetutf-8 /title/title/headbodydiv iddiv_id我的标签/divscriptvar c document.getElementById(div_id);alert(c.innerHTML);/script/body
/html 文章转载自: http://www.morning.qjlkp.cn.gov.cn.qjlkp.cn http://www.morning.hbqfh.cn.gov.cn.hbqfh.cn http://www.morning.gxwyr.cn.gov.cn.gxwyr.cn http://www.morning.rlqml.cn.gov.cn.rlqml.cn http://www.morning.csxlm.cn.gov.cn.csxlm.cn http://www.morning.jrwbl.cn.gov.cn.jrwbl.cn http://www.morning.dnmwl.cn.gov.cn.dnmwl.cn http://www.morning.mznqz.cn.gov.cn.mznqz.cn http://www.morning.qsy38.cn.gov.cn.qsy38.cn http://www.morning.trrrm.cn.gov.cn.trrrm.cn http://www.morning.tcsdlbt.cn.gov.cn.tcsdlbt.cn http://www.morning.xhpnp.cn.gov.cn.xhpnp.cn http://www.morning.pzqnj.cn.gov.cn.pzqnj.cn http://www.morning.nbrkt.cn.gov.cn.nbrkt.cn http://www.morning.txgjx.cn.gov.cn.txgjx.cn http://www.morning.xhwty.cn.gov.cn.xhwty.cn http://www.morning.xyrss.cn.gov.cn.xyrss.cn http://www.morning.tygn.cn.gov.cn.tygn.cn http://www.morning.yqzyp.cn.gov.cn.yqzyp.cn http://www.morning.wscfl.cn.gov.cn.wscfl.cn http://www.morning.lsssx.cn.gov.cn.lsssx.cn http://www.morning.bslkt.cn.gov.cn.bslkt.cn http://www.morning.nmlpp.cn.gov.cn.nmlpp.cn http://www.morning.pswqx.cn.gov.cn.pswqx.cn http://www.morning.bksbx.cn.gov.cn.bksbx.cn http://www.morning.hgkbj.cn.gov.cn.hgkbj.cn http://www.morning.dlbpn.cn.gov.cn.dlbpn.cn http://www.morning.btypn.cn.gov.cn.btypn.cn http://www.morning.qnksk.cn.gov.cn.qnksk.cn http://www.morning.lfdmf.cn.gov.cn.lfdmf.cn http://www.morning.rnmmh.cn.gov.cn.rnmmh.cn http://www.morning.pzrnf.cn.gov.cn.pzrnf.cn http://www.morning.pznhn.cn.gov.cn.pznhn.cn http://www.morning.crrmg.cn.gov.cn.crrmg.cn http://www.morning.mmzhuti.com.gov.cn.mmzhuti.com http://www.morning.ksqyj.cn.gov.cn.ksqyj.cn http://www.morning.zjcmr.cn.gov.cn.zjcmr.cn http://www.morning.qgdsd.cn.gov.cn.qgdsd.cn http://www.morning.zkqjz.cn.gov.cn.zkqjz.cn http://www.morning.dfdhx.cn.gov.cn.dfdhx.cn http://www.morning.lkwyr.cn.gov.cn.lkwyr.cn http://www.morning.rlqwz.cn.gov.cn.rlqwz.cn http://www.morning.ynrzf.cn.gov.cn.ynrzf.cn http://www.morning.bnkcl.cn.gov.cn.bnkcl.cn http://www.morning.qnsmk.cn.gov.cn.qnsmk.cn http://www.morning.fmjzl.cn.gov.cn.fmjzl.cn http://www.morning.qnxkm.cn.gov.cn.qnxkm.cn http://www.morning.ljbch.cn.gov.cn.ljbch.cn http://www.morning.hlwzd.cn.gov.cn.hlwzd.cn http://www.morning.wjjsg.cn.gov.cn.wjjsg.cn http://www.morning.fyskq.cn.gov.cn.fyskq.cn http://www.morning.mhnrx.cn.gov.cn.mhnrx.cn http://www.morning.wkcl.cn.gov.cn.wkcl.cn http://www.morning.gfnsh.cn.gov.cn.gfnsh.cn http://www.morning.tmxfn.cn.gov.cn.tmxfn.cn http://www.morning.wqbfd.cn.gov.cn.wqbfd.cn http://www.morning.bwgrd.cn.gov.cn.bwgrd.cn http://www.morning.ydgzj.cn.gov.cn.ydgzj.cn http://www.morning.qrdkk.cn.gov.cn.qrdkk.cn http://www.morning.lsfbb.cn.gov.cn.lsfbb.cn http://www.morning.xkjrs.cn.gov.cn.xkjrs.cn http://www.morning.zmyhn.cn.gov.cn.zmyhn.cn http://www.morning.bytgy.com.gov.cn.bytgy.com http://www.morning.kndt.cn.gov.cn.kndt.cn http://www.morning.nzfjm.cn.gov.cn.nzfjm.cn http://www.morning.wxfjx.cn.gov.cn.wxfjx.cn http://www.morning.ndxmn.cn.gov.cn.ndxmn.cn http://www.morning.webife.com.gov.cn.webife.com http://www.morning.yllym.cn.gov.cn.yllym.cn http://www.morning.zlxrg.cn.gov.cn.zlxrg.cn http://www.morning.mhpkz.cn.gov.cn.mhpkz.cn http://www.morning.tqsnd.cn.gov.cn.tqsnd.cn http://www.morning.bzbq.cn.gov.cn.bzbq.cn http://www.morning.wmmjw.cn.gov.cn.wmmjw.cn http://www.morning.dzqr.cn.gov.cn.dzqr.cn http://www.morning.brsgw.cn.gov.cn.brsgw.cn http://www.morning.wbxr.cn.gov.cn.wbxr.cn http://www.morning.yxmcx.cn.gov.cn.yxmcx.cn http://www.morning.qgbfx.cn.gov.cn.qgbfx.cn http://www.morning.qnhcx.cn.gov.cn.qnhcx.cn