WEB开发网
开发学院软件开发Java JAVA AJAX教程第二章-JAVASCRIPT基础知识 阅读

JAVA AJAX教程第二章-JAVASCRIPT基础知识

 2009-10-27 00:00:00 来源:WEB开发网   
核心提示: 12 创建数组 程序代码 <scriptlanguage=”JavaScript”><!--varmyArray=newArray(5);myArray[0]=“FirstEntry”;myArray[1]=“Seco

12 创建数组

程序代码

<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”); 
// --> 
</script> 

13 数组排序

程序代码

<script language=”JavaScript”> 
<!-- 
var myArray = new Array(5); 
myArray[0] = “z”; 
myArray[1] = “c”; 
myArray[2] = “d”; 
myArray[3] = “a”; 
myArray[4] = “q”; 
document.write(myArray.sort()); 
// --> 
</script> 

14 分割字符串

程序代码

<script language=”JavaScript”> 
<!-- 
var myVariable = “a,b,c,d”; 
var stringArray = myVariable.split(“,”); 
document.write(stringArray[0]); 
document.write(stringArray[1]); 
document.write(stringArray[2]); 
document.write(stringArray[3]); 
// --> 
</script>  

上一页  4 5 6 7 8 9 10  下一页

Tags:JAVA AJAX 教程

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接