javascript常用函数总汇

1.document.write(""); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:
document->html->(head,body)
4.一个浏览器窗口中的DOM顺序是:
window->(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:
document.getElementById("表单中元素的ID号").name(或value)
6.一个小写转大写的JS:
document.getElementById("output").value=document.getElementById("input").value.toUpperCase();
7.JS中的值类型:
String,Number,Boolean,Null,Object,Function
8.JS中的字符型转换成数值型:
parseInt(),parseFloat()
9.JS中的数字转换成字符型:
("" 变量)
10.JS中的取字符串长度是:
(length)
11.JS中的字符与字符相连接使用+号.
12.JS中的比较操作符有:
==等于,!=不等于,>,>=,<.<=
13.JS中声明变量使用:
var来进行声明
14.JS中的判断语句结构:
if(condition){}else{}
15.JS中的循环结构:
for([initial expression];[condition];[upadte expression]) {inside loop}
16.循环中止的命令是:
break
17.JS中的函数定义:
function functionName([parameter],…){statement[s]}
18.当文件中出现多个form表单时.可以用document.forms[0],document.forms[1]来代替.
19.窗口:
打开窗口window.open(), 关闭一个窗口:window.close(), 窗口本身:self
20.状态栏的设置:
window.status="字符";
21.弹出提示信息:
window.alert("字符");
22.弹出确认框:
window.confirm();
23.弹出输入提示框:
window.prompt();
24.指定当前显示链接的位置:
window.location.href="URL"
25.取出窗体中的所有表单的数量:
document.forms.length
26.关闭文档的输出流:
document.close();
27.字符串追加连接符: =
28.创建一个文档元素:
document.createElement(),document.createTextNode()
29.得到元素的方法:
document.getElementById()
30.设置表单中所有文本型的成员的值为空:
var form = window.document.forms[0]
for (var i = 0; i
49.引用一个文件式的JS:
50.指定在不支持脚本的浏览器显示的HTML:
51.当超链和onCLICK事件都有时,则老版本的浏览器转向a.html,否则转向b.html.
例:dfsadf
52.JS的内建对象有:
Array,Boolean,Date,Error,EvalError,
Function,Math,Number,Object,RangeError,ReferenceError,
RegExp,String,SyntaxError,TypeError,URIError
53.JS中的换行:\n
54.窗口全屏大小:

55.JS中的all代表其下层的全部元素
56.JS中的焦点顺序:document.getElementByid("表单元素").tabIndex = 1
57.innerHTML的值是表单元素的值:
如

"how are you"

,则innerHTML的值就是:how are you 58.innerTEXT的值和上面的一样,只不过不会把这种标记显示出来. 59.contentEditable可设置元素是否可被修改,isContentEditable返回是否可修改的状态. 60.isDisabled判断是否为禁止状态.disabled设置禁止状态 61.length取得长度,返回整型数值 62.addBehavior()是一种JS调用的外部函数文件其扩展名为.htc 63.window.focus()使当前的窗口在所有窗口之前. 64.blur()指失去焦点.与FOCUS()相反. 65.select()指元素为选中状态. 66.防止用户对文本框中输入文本: οnfοcus="this.blur()" 67.取出该元素在页面中出现的数量: document.all.tags("div(或其它HTML标记符)").length 68.JS中分为两种窗体输出:模态和非模态. window.showModaldialog(),window.showModeless() 69.状态栏文字的设置: window.status='文字',默认的状态栏文字设置:window.defaultStatus = '文字.'; 70.添加到收藏夹: external.AddFavorite("http://www.dannyg.com";,"jaskdlf"); 71.JS中遇到脚本错误时不做任何操作: window.onerror = doNothing; 指定错误句柄的语法为:window.onerror = handleError; 72.JS中指定当前打开窗口的父窗口: window.opener,支持opener.opener…的多重继续. 73.JS中的self指的是当前的窗口 74.JS中状态栏显示内容:window.status="内容" 75.JS中的top指的是框架集中最顶层的框架 76.JS中关闭当前的窗口:window.close(); 77.JS中提出是否确认的框:if(confirm("Are you sure?")){alert("ok");}else{alert("Not Ok");} 78.JS中的窗口重定向:window.navigate("http://www.sina.com.cn";); 79.JS中的打印:window.print() 80.JS中的提示输入框:window.prompt("message","defaultReply"); 81.JS中的窗口滚动条:window.scroll(x,y) 82.JS中的窗口滚动到位置:window.scrollby 83.JS中设置时间间隔:setInterval("expr",msecDelay)或setInterval(funcRef,msecDelay)或setTimeout 84.JS中的模态显示在IE4 行,在NN中不行:showModalDialog("URL"[,arguments][,features]); 85.JS中的退出之前使用的句柄: function verifyClose(){event.returnValue="we really like you and hope you will stay longer.";}} window.=verifyClose; 86.当窗体第一次调用时使用的文件句柄:onload() 87.当窗体关闭时调用的文件句柄:onunload() 88.window.location的属性: protocol(http:),hostname(www.example.com),port(80),host(www.example.com:80), pathname("/a/a.html"),hash("#giantGizmo",指跳转到相应的锚记),href(全部的信息) 89.window.location.reload()刷新当前页面. 90.window.history.back()返回上一页,window.history.forward()返回下一页, window.history.go(返回第几页,也可以使用访问过的URL) 91.document.write()不换行的输出,document.writeln()换行输出 92.document.body.noWrap=true;防止链接文字折行. 93.变量名.charAt(第几位),取该变量的第几位的字符. 94."abc".charCodeAt(第几个),返回第几个字符的ASCii码值. 95.字符串连接:string.concat(string2),或用 =进行连接 96.变量.indexOf("字符",起始位置),返回第一个出现的位置(从0开始计算) 97.string.lastIndexOf(searchString[,startIndex])最后一次出现的位置. 98.string.match(regExpression),判断字符是否匹配. 99.string.replace(regExpression,replaceString)替换现有字符串. 100.string.split(分隔符)返回一个数组存储值. 101.string.substr(start[,length])取从第几位到指定长度的字符串. 102.string.toLowerCase()使字符串全部变为小写. 103.string.toUpperCase()使全部字符变为大写. 104.parseInt(string[,radix(代表进制)])强制转换成整型. 105.parseFloat(string[,radix])强制转换成浮点型. 106.isNaN(变量):测试是否为数值型. 107.定义常量的关键字:const,定义变量的关键字:var 教程:JavaScript就这么回事1-5 有些时候你精通一门语言,但是会发现你其实整天在和其它语言打交道,也许你以为这些微不足道,不至于影响你的开发进度,但恰恰是这些你不重视的东西会浪费你很多时间,我一直以为我早在几年前就已经精通JavaScript了,直到目前,我才越来越觉得JavaScript远比我想象的复杂和强大,我开始崇拜它,就像崇拜所有OOP语言一样~ 趁着节日的空隙,把有关JavaScript的方法和技巧整理下,让每个在为JavaScript而烦恼的人明白,JavaScript就这么回事!并希望JavaScript还可以成为你的朋友,让你豁然开朗,在项目中更好的应用~ 适合阅读范围:对JavaScript一无所知~离精通只差一步之遥的人 基础知识:HTML JavaScript就这么回事1:基础知识 1 创建脚本块 1: 2 隐藏脚本代码 1: 在不支持JavaScript的浏览器中将不执行相关代码 3 浏览器不支持的时候显示 1: 4 链接外部脚本文件 1: 5 注释脚本 1: // This is a comment 2: document.write(“Hello”); // This is a comment 3: /* 4: All of this 5: is a comment 6: */ 6 输出到浏览器 1: document.write(“Hello”); 7 定义变量 1: var myVariable = “some value”; 8 字符串相加 1: var myString = “String1” + “String2”; 9 字符串搜索 1: 10 字符串替换 1: thisVar.replace(“Monday”,”Friday”); 11 格式化字串 1: 12 创建数组 1: 13 数组排序 1: 14 分割字符串 1: 15 弹出警告信息 1: 16 弹出确认框 1: 17 定义函数 1: 18 调用JS函数 1: Link text 2: Link text 19 在页面加载完成后执行函数 1: 2: Body of the page 3: 20 条件判断 1: 21 指定次数循环 1: 22 设定将来执行 1: 23 定时执行函数 1: 24 取消定时执行 1: 25 在页面卸载时候执行函数 1: 2: Body of the page 3: JavaScript就这么回事2:浏览器输出 26 访问document对象 1: 27 动态输出HTML 1: 28 输出换行 1: document.writeln(“a”); 2: document.writeln(“b”); 29 输出日期 1: 30 指定日期的时区 1: 31 设置日期输出格式 1: 32 读取URL参数 1: 你还以为HTML是无状态的么? 33 打开一个新的document对象 1: 34 页面跳转 1: 35 添加网页加载进度窗口 1: 2: 3: 6: The Main Page 7: 8: 9:

This is the main page

10: 11: JavaScript就这么回事3:图像 36 读取图像属性 1: 2: Width 3: 37 动态加载图像 1: 38 简单的图像替换 1: 7: 9: 39 随机显示图像 1: 40 函数实现的图像替换 1: 14: 16: 17: 41 创建幻灯片 1: 19: 20: 21: 42 随机广告图片 1: JavaScript就这么回事4:表单 还是先继续写完JS就这么回事系列吧~ 43 表单构成 1:
2: 3: 7:
8: 9:
44 访问表单中的文本框内容 1:
2: 3:
4: Check Text Field 45 动态复制文本框内容 1:
2: Enter some Text:
3: Copy Text: 4:
5: Copy Text Field 46 侦测文本框的变化 1:
2: Enter some Text: 3:
47 访问选中的Select 1:
2: 7:
8: Check Selection List 48 动态增加Select项 1:
2: 6:
7: 49 验证表单字段 1: 9:
10: Text Field: 11:
12:
50 验证Select项 1: function checkList(selection) { 2: if (selection.length == 0) { 3: window.alert(“You must make a selection from the list.”); 4: return false; 5: } 6: return true; 7: } 51 动态改变表单的action 1:
2: Username:
3: Password:
4: 5: 6: 7:
52 使用图像按钮 1:
2: Username:
3: Password:
4: 5:
6: 53 表单数据的加密 1: 18:
19: Enter Some Text: 20:
JavaScript就这么回事5:窗口和框架 54 改变浏览器状态栏文字提示 1: 55 弹出确认提示框 1: 56 提示输入 1: 57 打开一个新窗口 1: //打开一个名称为myNewWindow的浏览器新窗口 2: 58 设置新窗口的大小 1: 59 设置新窗口的位置 1: 60 是否显示工具栏和滚动栏 1: 62 加载一个新的文档到当前窗口 1: Open New Document 63 设置页面的滚动位置 1: 64 在IE中打开全屏窗口 1: Open a full-screen window 65 新窗口和父窗口的操作 1: 6: 在新窗口中关闭父窗口 7: window.opener.close() 66 往新窗口中写内容 1: 67 加载页面到框架页面 1: 2: 3: 4: 5: 在frame1中加载frame2中的页面 6: parent.frame2.document.location = “135b.html”; 68 在框架页面之间共享脚本 如果在frame1中html文件中有个脚本 1: function doAlert() { 2: window.alert(“Frame 1 is loaded”); 3: } 那么在frame2中可以如此调用该方法 1: 2: This is frame 2. 3: 69 数据公用 可以在框架页面定义数据项,使得该数据可以被多个框架中的页面公用 1: 4: 5: 6: 7: 这样在frame1和frame2中都可以使用变量persistentVariable 70 框架代码库 根据以上的一些思路,我们可以使用一个隐藏的框架页面来作为整个框架集的代码库 1: 2: 3: 4: 5: 教程:事半功倍系列之javascript From:向东IT博客 本文由经典论坛 邓永炎 整理 清华大学出版的《事半功倍系列 javascript》,本人照着书敲出来的,有些翻译了一下.前几年看了一下,最近无事,重新翻了翻,很有帮助.本书应该有光盘的,但学校的书,光盘不知在哪.希望对你学 javascript有帮助 第一章javascript简介 1.在地址栏输入javascript语句 Javascript:Document.write("显示文字") 2.将javascript嵌入 HTML文档 第二章 使用变量和数组 1.声明变量 2.使用整数 3.使用浮点数 浮点数1:1234567890000
浮点数2:5.14e+23
浮点数3:0.0000123456
浮点数4:6021.4
4.使用布尔值 显示布尔1:true
显示布尔2:false
5.使用字符串 显示字符串1:fdsgdg dsfdsf china
显示字符串2:武汉市广播电视大学
6.确定变量类型 变量1的类型是:number
变量2的类型是:number
变量3的类型是:string
变量4的类型是:boolean
7.将字符串转换成数字 str1的数据类型是 :string
int1的数据类型是 :number
8.将数字转换成字符串 str1的数据类型是 :string
int1的数据类型是 :number
9.声明数组 数组是:1 3 5 7 11 10.确定数组元素的个数 数组是:1 3 5 7 11
数组的元素个数是5 11.将数组转换为字符串 dark,apple,nebula,water
dark apple nebula water 12.对数组排序 apple,dark,nebula,water
第三章 创建表达式 1.使用算术运算符 数据1是:12
数据2是:10
数据相加是:22
数据相减是:2
数据相乘是:120
数据相除是:1.2
数据相除取余数是:2
2.递增变量和递减变量 输出变量1
递增后变量变为:2 3.创建比较表达式 days of month:28
month:february 4.创建逻辑表达式 days of month:28
month:february 5.使用条件运算符 输出结果dinner 6.识别数字 第四章 控制程序流程 1.使用IF –Else语句 今天是圣诞节,商店关门 2.使用for 循环 输出第1句
输出第2句
输出第3句
输出第4句
输出第5句
输出第6句
输出第7句
输出第8句
输出第9句
输出第10句
3.使用while循环 输出第1句
输出第2句
输出第3句
输出第4句
输出第5句
输出第6句
输出第7句
输出第8句
输出第9句
输出第10句
输出第11句
输出第12句
输出第13句
输出第14句
输出第15句
4.中断循环 输出第2句
输出第3句
输出第4句
输出第5句
输出第6句
输出第7句
5.继续循环 输出第2句
输出第3句
输出第4句
输出第5句
输出第6句
输出第7句
输出第9句
输出第10句
输出第11句
输出第12句
输出第13句
输出第14句
输出第15句
输出第16句
6.使用javascript定时器 7.设置定期间隔


8.清除超时和间隔


第五章 使用函数 1.声明函数 2.调用函数 输出语句 3.了解全局变量和局部变量 任何不用 var关键字声明的变量都是全局变量,任何在函数外声明的变量都是全局变量 4.将参数传送给函数 输出参数fgdfgd
输出参数参数二
5.从函数返回值 输出结果56 6.通过HTML链接调用函数 通过HTML链接调用函数 通过HTML链接调用函数,直接写javascript语句 第六章 处理事件 1.检查鼠标单击
2.检测双击
3.创建悬停按钮 4.检测按键
5.设置焦点
6.检测下拉菜单选择
7.创建网页加载和卸载信息
第七章 使用对象 1.理解对象\属性和方法 页面背景颜色是:blue页面前景颜色是: 2.使用网页元素对象
3.使用子对象
4.使用预定义对象 dgdfgdfgdfhf固定法固定法功夫攻打法
dfgdfhf固定法固定法功夫攻打法
输出圆的面积:78.53981633974483 5.创建新对象 今天是3月7日
现在是:3/7/2025, 12:53:29 PM 6.引用当前对象 7.查看对象属性 window.window=[object Window]
window.self=[object Window]
window.document=[object HTMLDocument]
window.name=
window.location=https://www.e-com-net.com/article/1304421439272685568.htm
window.customElements=[object CustomElementRegistry]
window.history=[object History]
window.navigation=[object Navigation]
window.locationbar=[object BarProp]
window.menubar=[object BarProp]
window.personalbar=[object BarProp]
window.scrollbars=[object BarProp]
window.statusbar=[object BarProp]
window.toolbar=[object BarProp]
window.status=
window.closed=false
window.frames=[object Window]
window.length=0
window.top=[object Window]
window.opener=null
window.parent=[object Window]
window.frameElement=null
window.navigator=[object Navigator]
window.origin=https://www.e-com-net.com
window.external=[object External]
window.screen=[object Screen]
window.innerWidth=1280
window.innerHeight=720
window.scrollX=0
window.pageXOffset=0
window.scrollY=0
window.pageYOffset=0
window.visualViewport=[object VisualViewport]
window.screenX=0
window.screenY=0
window.outerWidth=1280
window.outerHeight=720
window.devicePixelRatio=1
window.event=undefined
window.clientInformation=[object Navigator]
window.screenLeft=0
window.screenTop=0
window.styleMedia=[object StyleMedia]
window.onsearch=null
window.isSecureContext=true
window.trustedTypes=[object TrustedTypePolicyFactory]
window.performance=[object Performance]
window.onappinstalled=null
window.onbeforeinstallprompt=null
window.crypto=[object Crypto]
window.indexedDB=[object IDBFactory]
window.sessionStorage=[object Storage]
window.localStorage=[object Storage]
window.onbeforexrselect=null
window.onabort=null
window.onbeforeinput=null
window.onbeforematch=null
window.onbeforetoggle=null
window.onblur=null
window.oncancel=null
window.oncanplay=null
window.oncanplaythrough=null
window.onchange=null
window.onclick=null
window.onclose=null
window.oncontentvisibilityautostatechange=null
window.oncontextlost=null
window.oncontextmenu=null
window.oncontextrestored=null
window.oncuechange=null
window.ondblclick=null
window.ondrag=null
window.ondragend=null
window.ondragenter=null
window.ondragleave=null
window.ondragover=null
window.ondragstart=null
window.ondrop=null
window.ondurationchange=null
window.onemptied=null
window.onended=null
window.onerror=null
window.onfocus=null
window.onformdata=null
window.oninput=null
window.oninvalid=null
window.onkeydown=null
window.onkeypress=null
window.onkeyup=null
window.onload=null
window.onloadeddata=null
window.onloadedmetadata=null
window.onloadstart=null
window.onmousedown=null
window.onmouseenter=null
window.onmouseleave=null
window.onmousemove=null
window.onmouseout=null
window.onmouseover=null
window.onmouseup=null
window.onmousewheel=null
window.onpause=null
window.onplay=null
window.onplaying=null
window.onprogress=null
window.onratechange=null
window.onreset=null
window.onresize=null
window.onscroll=null
window.onsecuritypolicyviolation=null
window.onseeked=null
window.onseeking=null
window.onselect=null
window.onslotchange=null
window.onstalled=null
window.onsubmit=null
window.onsuspend=null
window.ontimeupdate=null
window.ontoggle=null
window.onvolumechange=null
window.onwaiting=null
window.onwebkitanimationend=null
window.onwebkitanimationiteration=null
window.onwebkitanimationstart=null
window.onwebkittransitionend=null
window.onwheel=null
window.onauxclick=null
window.ongotpointercapture=null
window.onlostpointercapture=null
window.onpointerdown=null
window.onpointermove=null
window.onpointerrawupdate=null
window.onpointerup=null
window.onpointercancel=null
window.onpointerover=null
window.onpointerout=null
window.onpointerenter=null
window.onpointerleave=null
window.onselectstart=null
window.onselectionchange=null
window.onanimationend=null
window.onanimationiteration=null
window.onanimationstart=null
window.ontransitionrun=null
window.ontransitionstart=null
window.ontransitionend=null
window.ontransitioncancel=null
window.onafterprint=null
window.onbeforeprint=null
window.onbeforeunload=null
window.onhashchange=null
window.onlanguagechange=null
window.onmessage=null
window.onmessageerror=null
window.onoffline=null
window.ononline=null
window.onpagehide=null
window.onpageshow=null
window.onpopstate=null
window.onrejectionhandled=null
window.onstorage=null
window.onunhandledrejection=null
window.onunload=null
window.crossOriginIsolated=false
window.scheduler=[object Scheduler]
window.alert=function alert() { [native code] }
window.atob=function atob() { [native code] }
window.blur=function blur() { [native code] }
window.btoa=function btoa() { [native code] }
window.cancelAnimationFrame=function cancelAnimationFrame() { [native code] }
window.cancelIdleCallback=function cancelIdleCallback() { [native code] }
window.captureEvents=function captureEvents() { [native code] }
window.clearInterval=function clearInterval() { [native code] }
window.clearTimeout=function clearTimeout() { [native code] }
window.close=function close() { [native code] }
window.confirm=function confirm() { [native code] }
window.createImageBitmap=function createImageBitmap() { [native code] }
window.fetch=function fetch() { [native code] }
window.find=function find() { [native code] }
window.focus=function focus() { [native code] }
window.getComputedStyle=function getComputedStyle() { [native code] }
window.getSelection=function getSelection() { [native code] }
window.matchMedia=function matchMedia() { [native code] }
window.moveBy=function moveBy() { [native code] }
window.moveTo=function moveTo() { [native code] }
window.open=function open() { [native code] }
window.postMessage=function postMessage() { [native code] }
window.print=function print() { [native code] }
window.prompt=function prompt() { [native code] }
window.queueMicrotask=function queueMicrotask() { [native code] }
window.releaseEvents=function releaseEvents() { [native code] }
window.reportError=function reportError() { [native code] }
window.requestAnimationFrame=function requestAnimationFrame() { [native code] }
window.requestIdleCallback=function requestIdleCallback() { [native code] }
window.resizeBy=function resizeBy() { [native code] }
window.resizeTo=function resizeTo() { [native code] }
window.scroll=function scroll() { [native code] }
window.scrollBy=function scrollBy() { [native code] }
window.scrollTo=function scrollTo() { [native code] }
window.setInterval=function setInterval() { [native code] }
window.setTimeout=function setTimeout() { [native code] }
window.stop=18
window.structuredClone=function structuredClone() { [native code] }
window.webkitCancelAnimationFrame=function webkitCancelAnimationFrame() { [native code] }
window.webkitRequestAnimationFrame=function webkitRequestAnimationFrame() { [native code] }
window.__playwright__binding__=function () { [native code] }
window.caches=[object CacheStorage]
window.cookieStore=[object CookieStore]
window.ondevicemotion=null
window.ondeviceorientation=null
window.ondeviceorientationabsolute=null
window.launchQueue=[object LaunchQueue]
window.sharedStorage=[object SharedStorage]
window.documentPictureInPicture=[object DocumentPictureInPicture]
window.getScreenDetails=function getScreenDetails() { [native code] }
window.openDatabase=function openDatabase() { [native code] }
window.queryLocalFonts=function queryLocalFonts() { [native code] }
window.showDirectoryPicker=function showDirectoryPicker() { [native code] }
window.showOpenFilePicker=function showOpenFilePicker() { [native code] }
window.showSaveFilePicker=function showSaveFilePicker() { [native code] }
window.originAgentCluster=true
window.onpageswap=null
window.onpagereveal=null
window.credentialless=false
window.fence=null
window.speechSynthesis=[object SpeechSynthesis]
window.onscrollend=null
window.onscrollsnapchange=null
window.onscrollsnapchanging=null
window.webkitRequestFileSystem=function webkitRequestFileSystem() { [native code] }
window.webkitResolveLocalFileSystemURL=function webkitResolveLocalFileSystemURL() { [native code] }
window.__pwInitScripts=[object Object]
window.$=function(a,b){return new r.fn.init(a,b)}
window.jQuery=function(a,b){return new r.fn.init(a,b)}
window._hmt=[object Object]
window.query2=function query2(url,keyword,pageNo) { if (keyword.length > 0) { window.location.href = url + encodeURIComponent(keyword) + "/" +pageNo; }else{ window.location.href = url +pageNo; } }
window.query3=function query3(keyword) { if (keyword.length > 0) { window.location.href = "/search/" + encodeURIComponent(keyword) + "/1.htm"; } }
window.query=function query() { var keyword = $("#keyword").val(); if (keyword.length > 0) { window.location.href = "/search/" + encodeURIComponent($("#keyword").val()) + "/1.htm"; } }
window._bdhm_loaded_5f66e2c54c9e24dc017f0ad3679ae5f6=true
window.mini_tangram_log_8t0j4b=[object HTMLImageElement]
window.___baidu_union=[object Object]
window.___delivery___global___counter___=[object Object]
window.BAIDU_SSP__info=[object Object]
window.__delivery_global_=[object Object]
window.___adblockplus_=function(){var t=Array.prototype.slice.apply(arguments);return r.apply(e,t.concat(i))}
window.___baidu_union_callback=function(t){try{var n=Array.prototype.slice.call(arguments,1);switch(t){case"auto":w.sr.apply(w,n);break;case 1:E.Cr.apply(E,n);break;case 2:I.Tr.apply(I,n);break;case 3:D.Ae.apply(D,n)}}catch(i){b.an(r.Z,i,{pos:"commoncallback"})}}
window.BAIDU_DUP2_pageFirstRequestTime=1741352008513
window.cpro_id=null
window.cproArray=null
window.cpro_mobile_slot=null
window.BAIDU_DUP=[object Object]
window.BAIDU_CLB_SLOT_ID=null
window.BAIDU_CLB_fillSlot=function(t,n){t&&((t=o.In({slotId:t,productLine:"clb",isAsync:!!n})).containerId=n||t.containerId,o.Sn(t),o.On())}
window.BAIDU_CLB_singleFillSlot=function(t,n){t&&((t=o.In({slotId:t,productLine:"clb",isAsync:!!n})).containerId=n||t.containerId,o.Sn(t),o.On())}
window.BAIDU_CLB_fillSlotWithSize=function(t,n){t&&((t=o.In({slotId:t,productLine:"clb",isAsync:!!n})).containerId=n||t.containerId,o.Sn(t),o.On())}
window.BAIDU_CLB_fillSlotAsync=function(t,n){t&&((t=o.In({slotId:t,productLine:"clb",isAsync:!!n})).containerId=n||t.containerId,o.Sn(t),o.On())}
window.BAIDU_CLB_prepareMoveSlot=function(t){try{for(var n=0,i=t+"_"+n;o.xn(i)&&0!==o.xn(i)[0];){var e=o.xn(i);o.Tn(e,a.R),i=t+"_"+ ++n}}catch(r){}}
window.BAIDU_CLB_setConfig=function(){var t=Array.prototype.slice.apply(arguments);return r.apply(e,t.concat(i))}
window.BAIDU_CLB_addOrientation=function(){var t=Array.prototype.slice.apply(arguments);return r.apply(e,t.concat(i))}
window.BAIDU_CLB_addSlot=function(){}
window.BAIDU_CLB_enableAllSlots=function(){}
window.BAIDU_CLB_preloadSlots=function(){}
window.BAIDU_DUP_addSlotStatusCallback=function(){}
window.slotbydup=[object Object]
window.fullScreen=function fullScreen(){ this.moveTo(0,0);this.outerWidth=screen.availWidth; this.outerHeight=screen.availHeight;}
window.maximize=function fullScreen(){ this.moveTo(0,0);this.outerWidth=screen.availWidth; this.outerHeight=screen.availHeight;}
window.num1=1234567890000
window.num2=5.14e+23
window.num3=0.0000123456
window.num4=6021.4
window.answer1=9
window.answer2=2.5
window.str1=dgdfgdfgdfhf固定法固定法功夫攻打法
window.str2=dfgdfhf固定法固定法功夫攻打法
window.answer3=milky may
window.answer4=true
window.int1=256
window.array=apple,dark,nebula,water
window.var1=24
window.var2=10
window.varadd=22
window.varsub=2
window.varmult=120
window.vardiv=1.2
window.varmod=2
window.days=2
window.daysofmonth=28
window.month=december
window.dayofmonth=28
window.stomach=hungry
window.time=5:00
window.eat=dinner
window.date=25
window.count=16
window.rabbit=function rabbit() {document.write("输出语句") }
window.quote=function quote(){ document.write(" 输出字符串") }
window.f=function f(item) {document.write("输出参数"+item+"
") }
window.average=function average(var1,var2,var3) {ave=(var1+var2+var3)/3; document.write("输出结果"); return ave; }
window.ave=56
window.today=Fri Mar 07 2025 12:53:29 GMT+0000 (Coordinated Universal Time)
window.TEMPORARY=0
window.PERSISTENT=1
window.addEventListener=function addEventListener() { [native code] }
window.dispatchEvent=function dispatchEvent() { [native code] }
window.removeEventListener=function removeEventListener() { [native code] }
location.ancestorOrigins=undefined
location.href=undefined
location.origin=undefined
location.protocol=undefined
location.host=undefined
location.hostname=undefined
location.port=undefined
location.pathname=undefined
location.search=undefined
location.hash=undefined
location.assign=undefined
location.reload=undefined
location.replace=undefined
location.toString=undefined
8.使用Array对象 数组元素个数是undefined
用 join将数组合并bark apple nebula cookie technology
数组排序apple,bark,cookie,nebula,technology,,,,, 9.使用 image 对象 图片提示…. 图片提示是:iteye_20009
图片边框大小是:undefined 10.预加载图像 , 11.改变图像
12.使用link和anchor对象 锚点1
Microsoft
sohu
sina
本页面共有25链接
本页面共有1锚点
第一个链接协议是https:
第一个链接路径是undefined
第一个链接href是undefined
13.改变链接 link
14.使用history对象
第八章 使用窗口 1.在浏览器的状态栏上显示文本 sohu 2.改变背景色 3.列举背景颜色 当前背景色是:orange 4.改变文本和链接颜色

看看这段文本颜色

sohu 5.改变文档标题 welcome to Mouse's House 6.显示修改日期 本页面最后修改时间是03/07/2025 12:53:29 7.查看当前文档的URL 本页面的URL:https://www.e-com-net.com/article/1304421439272685568.htm 8.查看引用页 本页面的引用页是 9.打开新的浏览器窗口 10.关闭远程窗口 close.html: 正文
open.html 11.打印窗口 正文
12.移动窗口
水平方向 垂直方向
水平方向 垂直方向
13.改变窗口大小
水平方向 垂直方向
水平方向 垂直方向
14.用警告对话框通知用户 15.用提示对话框接受输入 欢迎您:null来到这里 16.用确认对话框使用户做出决定 希望得到你的夸奖 第九章 使用字符串 1.使用字符串对象 gdgdfgfddddaaaaaaaaaaaabbbbbbbbbbbbbbbbbvbhg.
gdgdfgfddddaaaaaaaaaaaabbbbbbbbbbbbbbbbbvbhg.
GDGDFGFDDDDAAAAAAAAAAAABBBBBBBBBBBBBBBBBVBHG.
2.使用子字符串 fdsf 1111 gfdgfd dfdsf cccc dddd.
fdsf 1111 gfd
sf cccc ddd
3.连接字符串 may you find
peace,happiness and prosperity.
may you findpeace,happiness and prosperity.
may you findpeace,happiness and prosperity.
4.格式化字符串变量 peace,happiness and prosperity.
peace,happiness and prosperity.
peace,happiness and prosperity.
peace,happiness and prosperity.
peace,happiness and prosperity.
peace,happiness and prosperity.
peace,happiness and prosperity.
5.创建锚和链接 this is the bigginning of the page.
….
….
….
….
….
….
….
….
….
….
this is the end of the page .
link to the start
link to the end
6.确定字符串长度 this is the bigginning of the page.
字符串的长度是:35字符串全部大写是;THIS IS THE BIGGINNING OF THE PAGE.字符串全部小写是;this is the bigginning of the page. 7.在字符串内搜索 this is the end of the line.
字符end在字符串的位置是12字符dog在字符串的位置是-1 8.定位字符串中的字符 spring is a time for flowers and trees and baby bunnles
the index for the second word ‘and' is39 9.替换字符串中的文本 spring is a time for flowers and trees and baby bunnles
spring is a time for flowers , trees and baby bunnles
10.字符串分离 spring is a time for flowers and trees and baby bunnles
spring
is
a
time
第十章 使用日期和时间 1.使用Date对象 Wed Aug 02 1989 12:30:00 GMT+0000 (Coordinated Universal Time) 2.显示当地时间和日期 当前时间是:Fri, 07 Mar 2025 12:53:29 GMT
日期和时间是:3/7/2025, 12:53:29 PM 3.获得时间和日期值 显示当前的星期5
显示当前的月份2
显示当前的日期5
显示当前的年份125
显示当前的小时12
显示当前的分钟53
显示当前的秒29
4.设置时间和日期值 显示日期Tue Dec 25 1984 00:00:00 GMT+0000 (Coordinated Universal Time)
设置月份470188800000
设置日期470016000000
设置年份974937600000
设置小时974984400000
设置分钟974987220000
设置秒974987243000
显示设置后的日期和时间Thu Nov 23 2000 13:47:23 GMT+0000 (Coordinated Universal Time) 第十一章 使用Math对象 1. 使用Math对象
圆的半径:
圆的面积:
2.生成随机数 随机输出某一句
这是第6句 3.使用平方根
value:
平方根
4.数字的舍入
输入
舍入的结果
5.乘方运算
底数
指数

6.发现最小值和最大值
数字1
数字2
最小值
最大值
数字1
第十二章 使用表单 1.使用文本框
2.使用密码框
3.使用隐藏字段
4.使用文本区域框
6.使用重置按钮
7.使用提交按钮
8.使用复选按钮
computer savvy?
9.使用单选按钮
male female
10.使用选择列表
11.验证表单的有效性
请输入1~4的整数:
12.控制表单焦点






第十三章 使用分栏 第十四章 使用navigator 1.使用navigator对象 navigator对象的属性
appcodename:Mozilla
appname::Netscape
appversion:5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
platform:Linux x86_64
userAgent:Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
navigator对象的方法
javaEnabled():false 2.检查用户的浏览器 用户浏览器是netscape的netscape浏览器
this browser is not 4.0 compliant 3.检测用户的操作系统 this computer is not running windows 95 or higher 4.使用location对象 location对象的属性
hash
hostnamewww.e-com-net.com
hostwww.e-com-net.com
hrefhttps://www.e-com-net.com/article/1304421439272685568.htm
port
search
重新加载网页
5.使用cookie 本文地址:http://www.bhcode.net/article_show.asp?showid=88

 

你可能感兴趣的:(javascript)