JavaScript主要对象测试代码
2010-06-16 17:32
387 查看
<html>
<head>
<title>我的第一个 HTML 页面</title>
</head>
<body>
<script>
document.write("Array begin********"+'<br>');
var my_array = new Array();
for (i = 0; i < 2; i++)
{
my_array[i] = i;
document.write(my_array[i]+' ');
}
document.write('<br>'+"Array end********"+'<br>');
document.write('<br>'+"Date begin********"+'<br>');
var myDate=new Date();
document.write(myDate.getDate()+'/n');
var birthday = new Date("July 21, 1983 01:15:00")
document.write('Birthday is '+birthday.getDate());
document.write('<br>'+"Date end********"+'<br>');
document.write('<br>'+"Math begin********"+'<br>');
var pi_value=Math.PI;
var sqrt_value=Math.sqrt(15);
document.write(pi_value);
document.write('<br>'+sqrt_value);
document.write('<br>'+"Math end********"+'<br>');
document.write('<br>'+"RegExp begin********"+'<br>');
var myString="这是第一个正则表达式的例子";
var matchString="一个";
var myregex = new RegExp(matchString);
if(myregex.test(myString)){
document.write('Found string /"'+matchString+'/" in string' +'/"'+myString+'/"');
}
else{
document.write('Not found string /"'+matchString+'/" in string' +'/"'+myString+'/"');
}
document.write('<br>'+"RegExp end********"+'<br>');
document.write('<br>'+"Window begin********"+'<br>');
document.write('This will open a link in another window');
window.open("http://blog.csdn.net/makefish/archive/2010/06/15/5672767.aspx");
document.write('<br>'+"Window end********"+'<br>');
</script>
</body>
</html>
<head>
<title>我的第一个 HTML 页面</title>
</head>
<body>
<script>
document.write("Array begin********"+'<br>');
var my_array = new Array();
for (i = 0; i < 2; i++)
{
my_array[i] = i;
document.write(my_array[i]+' ');
}
document.write('<br>'+"Array end********"+'<br>');
document.write('<br>'+"Date begin********"+'<br>');
var myDate=new Date();
document.write(myDate.getDate()+'/n');
var birthday = new Date("July 21, 1983 01:15:00")
document.write('Birthday is '+birthday.getDate());
document.write('<br>'+"Date end********"+'<br>');
document.write('<br>'+"Math begin********"+'<br>');
var pi_value=Math.PI;
var sqrt_value=Math.sqrt(15);
document.write(pi_value);
document.write('<br>'+sqrt_value);
document.write('<br>'+"Math end********"+'<br>');
document.write('<br>'+"RegExp begin********"+'<br>');
var myString="这是第一个正则表达式的例子";
var matchString="一个";
var myregex = new RegExp(matchString);
if(myregex.test(myString)){
document.write('Found string /"'+matchString+'/" in string' +'/"'+myString+'/"');
}
else{
document.write('Not found string /"'+matchString+'/" in string' +'/"'+myString+'/"');
}
document.write('<br>'+"RegExp end********"+'<br>');
document.write('<br>'+"Window begin********"+'<br>');
document.write('This will open a link in another window');
window.open("http://blog.csdn.net/makefish/archive/2010/06/15/5672767.aspx");
document.write('<br>'+"Window end********"+'<br>');
</script>
</body>
</html>
相关文章推荐
- JavaScript基础语法测试代码,覆盖JavaScript五大对象和function!
- JavaScript 对象链式操作测试代码
- JavaScript 对象链式操作测试代码
- JavaScript基础语法测试代码,覆盖JavaScript五大对象和function!
- JavaScript中访问id对象 属性的方式访问属性(实例代码)
- 如何用QUnit来测试JavaScript代码
- 如何用QUnit来测试JavaScript代码
- JavaScript 中Date对象的格式化代码方法汇总
- 使用javascript的网速测试代码
- javascript测试代码-保存成html文件
- 在javascript代码中取得当前代码所在的script元素对象
- javascript创建createXmlHttpRequest对象示例代码
- 使用QUnit 框架测试Javascript代码
- 新书《编写可测试的JavaScript代码 》出版,感谢支持
- Javascript 修改String 对象 增加去除空格功能(示例代码)
- Jquery第一篇【介绍Jquery、回顾JavaScript代码、JS对象与JQ对象的区别】
- 服务器测试代码 主要用于新平台的socket的测试
- javascript获取函数名称、函数参数、对象属性名称的代码实例