- 3
- 0
- 约1.51万字
- 约 26页
- 2016-11-21 发布于河南
- 举报
JavaScript实现功能全集
JavaScript实现功能全集
JavaScript就这么回事1:基础知识
1 创建脚本块
script language=JavaScript
JavaScript code goes here
/script
2 隐藏脚本代码
script language=JavaScript
!--
document.write(Hello);
// --
/script
3 在不支持JavaScript的浏览器中将不执行相关代码,浏览器不支持的时候显示
noscript
Hello to the non-JavaScript browser.
/noscript
4 链接外部脚本文件
script language=JavaScript src=/filename.js/script
5 注释脚本
// This is a comment
document.write(Hello); // This is a comment
/*
All of this
is 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);
// --
/script
10 字符串替换
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);
// --
/script
12 创建数组
script language=JavaScript
!--
var myArray = new Array(4);
myArray[0] = First Entry;
myArray[1] = Second Entry;
myArray[2] = Third Entry;
myArray[3] = Fourth Entry;
var anotherArray = new Array(First Entry,Second Entry,Third Entry,Fourth Entry);
// --
/script
13 数组排序
script language=JavaScript
!--
var myArray = new Array(4);
myArray[0] = z;
myArray[1] = c;
myArray[2] = d;
myArray[3] = a;
document.write(myArray
您可能关注的文档
最近下载
- 2021年上海市嘉定区中考英语二模试卷含解析.pdf VIP
- 2025年广东省普通高中学业水平选择性考试生物(详解版).docx VIP
- 宁德市2025-2026学年(上期)高二期末考试数学试卷(含答案).pdf
- 鄂尔多斯职业学院单招《职业适应性测试》真题(达标题)附答案详解.docx VIP
- 2025年四川中科《浅谈肥胖治疗新进展》继续教育习题答案.docx VIP
- 小学三年级数学测量单元试题.docx VIP
- 三菱变频器使用手册-FR-E540 中文版.pdf VIP
- 小升初语文练习题6年级语文.pdf VIP
- 8.1 0—3岁婴幼儿心理发展评价(课件)《0-3岁婴幼儿心理发展与教育》(华东师范大学出版社).pptx VIP
- 《测量》习题3.doc VIP
原创力文档

文档评论(0)