- 1、本文档共12页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
1 打印笑脸!DOCTYPE htmlhtmlheadmeta charset=utf-8 /title/titlescriptvar icon =\u263a;document.write(icon);/script/headbody/body/html2 引用类型 Object判断变量的类型有两种方式:1. 采用typeof(): 打印的是所有类型的toString方法(所有类型的小写)2. 采用instanceof关键字判断:是判断变量是不是由某种类型new出来的scriptvar a ;a = 10 ;a = abc;a = true;a = function(){alert(aaa);}alert(typeof(a)) ;a = 10 ;a = new Number(10) ;//alert(a instanceof Number) ;//alert(typeof(a) == number) ;/script3 类型转化!DOCTYPE htmlhtmlheadmeta charset=utf-8 /title/titlescriptscript type=text/javascript!--/* 1.把字符串转换为number类型 a. parseInt,parseFloatb. (推荐) 乘以1 2. 把字符串转换为boolean牢记:非零为真,0为假 null,undefined,NaN都是假的 *//*var a = 123 ; a = a*1 ; alert(typeof(a)) ;*//*NaN: not a number */var a = NaN ;if(a)alert(真的) ;elsealert(假的);function fun(){//拿到文本框对象的value属性的值var txt = document.getElementById(age).value ;//判断内容if(txt==100)alert(年龄等于100) ;elsealert(年龄不等于100) ;}//--/script/headbody年龄:input type=text name= id = age input type=button value=弹出年龄 onclick=fun()/body/html4 JS跳转页面a.html!doctype htmlhtml lang=en head meta charset=UTF-8 meta name=Generator content=EditPlus? meta name=Author content= meta name=Keywords content= meta name=Description content= titlehistory对象/title /head script type=text/javascript !--/* history对象存储了访问过的页面。 */function fun(){history.forward(); }//--/script body aaaaaaaaaaaaaaaaaaaaaaaaaaa a href = b.htmlb.html/a input type=button value=前进 onclick=fun() /body/htmlb.html!doctype htmlhtml lang=en head meta charset=UTF-8 meta name=Generator content=EditPlus? meta name=Author content= meta name=Keywords content= meta name=Description content= titleDocument/title /head script type=text/javascript !--/* history对象存储了访问过的页面。 */function fun(){history.forward(); }function fun1(){history.back() ; }function fun2(){history.go(2) ; }//--/script body bbbbbbbbbbbbbbbbbb a href = c.htmlc.html/a input type=button value=前进 onclick=fun() input type=button value=后退 onclick=fun1() input type=button value=直接去d页面 onclick=fun2() /body/
文档评论(0)