- 3
- 0
- 约1.47万字
- 约 20页
- 2016-12-06 发布于重庆
- 举报
JavaScript就這么回事(JS基础知识整理)
1 创建脚本块引用内容程序代码script language=”JavaScript”JavaScript 代码写在这里面/script2 隐藏脚本代码引用内容程序代码script language=”JavaScript”!--document.write(“Hello”);// --/script在不支持JavaScript的浏览器中将不执行相关代码3 浏览器不支持的时候显示引用内容程序代码noscriptHello to the non-JavaScript browser./noscript4 链接外部脚本文件引用内容程序代码script language=”JavaScript” src=/”filename.js”/script5 注释脚本引用内容程序代码// This is a commentdocument.write(“Hello”); // This is a comment/*All of thisis a comment*/6 输出到浏览器引用内容程序代码document.write(“strongHello/strong”);7 定义变量引用内容程序代码var myVariable = “some value”;8 字符串相加引用内容程序代码var myString = “String1” + “String2”;9 字符串搜索引用内容程序代码script language=”JavaScript”!--var myVariable = “Hello there”;var therePlace = myVariable.search(“there”);document.write(therePlace);// --/script10 字符串替换引用内容程序代码thisVar.replace(“Monday”,”Friday”);11 格式化字串引用内容程序代码script language=”JavaScript”!--var myVariable = “Hello there”;document.write(myVariable.big() + “br”);document.write(myVariable.blink() + “br”);document.write(myVariable.bold() + “br”);document.write(myVariable.fixed() + “br”);document.write(myVariable.fontcolor(“red”) + “br”);document.write(myVariable.fontsize(“18pt”) + “br”);document.write(myVariable.italics() + “br”);document.write(myVariable.small() + “br”);document.write(myVariable.strike() + “br”);document.write(myVariable.sub() + “br”);document.write(myVariable.sup() + “br”);document.write(myVariable.toLowerCase() + “br”);document.write(myVariable.toUpperCase() + “br”);var firstString = “My String”;var finalString = firstString.bold().toLowerCase().fontcolor(“red”);// --/script12 创建数组引用内容程序代码script language=”JavaScript”!--var myArray = new Array(5);myArray[0] = “First Entry”;myArray[1] = “Second Entry”;myArray[2] = “Third Entry”;myArray[3] = “Fourth Entry”;myArray[4] = “Fifth Entry”;var anotherArray = new Array(“First Entry”,”Second Entry”,”Third Entry”,”Fourth Entry”,”Fifth Entry”);// --/script13 数组排序引用内容程序代码script language=”JavaScript”!--var myArray = new Array(5);myArray[0] = “z”;myArray[1] = “c”;myArray[2] = “d”;my
您可能关注的文档
最近下载
- 沈阳铁路局员工合同协议.docx VIP
- 2025年心理咨询师考试题库500道附参考答案【实用】.docx VIP
- 鱼骨图分析法(鱼骨图模板).doc VIP
- 2025年部编版三年级上册语文期末冲刺模拟卷三.docx VIP
- KISSsoft软件教程-Tutorial-016-包络面蜗轮蜗杆的验证.pdf VIP
- 《成人甲状腺功能减退症基层诊疗指南(2025版)》.docx VIP
- 三年级数学特训卷.docx VIP
- 搏击操教案15-16(1)完整版.doc VIP
- 2026年内分泌科糖尿病精细化管理实施方案.docx
- (2026春新版)人教版三年级数学下册《一 生活中的运动现象》PPT课件.pptx
原创力文档

文档评论(0)