关于基本的概念在这里就不说了,我依照书上的代码敲出了自己的第1个javasript程序,也就是自己的hello world 。对自己是1个很大的鼓励。下面我把代码贴出来和大家1块学习。
index.php
<?php
header('Content-type:text/html');
include 'test.html';
?>
test.html
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<script type ="text/javascript">
function cubeme(incomingNum){
if(incomingNum ==1){
return "what are you doing ?";
}else{
return Math.pow(incomingNum,3);
}
}
</script>
<title>JavaScript Test</title>
</head>
<body>
<script type ="text/javascript">
var theNum =2;
var finalNum =cubeme(theNum);
if(isNaN(finalNum)){
alert("You should know that 1 to any power is 1.");
}
else{
alert("when cubed ," + theNum + "is" + finalNum);
}
</script>
</body>
</html>
运行结果以下:
波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!
波比源码 » php开发之javascript第一个程序
波比源码 » php开发之javascript第一个程序