JavaScript基础

// JavaScript Document
function al()
    {
alert("hello")
    }

function number()
    {
prompt("输个数字进来哦","只能是数字哦")
    }

function shuzi()  //是数字返回false,不是数字返回true.
{
var a;
var b=prompt("输个数字进来吧","只能是数字啊");
    a=isNaN(b);
    {
    alert(a);
    }        
}

function shuzu()//定义数组
{
var ab=new Array();
ab[0]=123;
ab[1]="ab";
document.write(ab)}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script src="5-15.js" type="text/javascript" language="javascript">
</script>
</head>

<body>
<input type="button" onclick="al()" value="hello"><br>
<input type="button" onclick="number()" value="数字"><br>
<input type="button" onclick="shuzi()" value="判断是否为数字"><br>
<input type="button" onclick="shuzu()" value="获取数组里面的值"><br>
 

</body>
</html>

 

posted @ 2015-05-16 00:07  XCml  阅读(101)  评论(0编辑  收藏  举报