2.9.JavaScript内置对象

<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>内置对象</title>
</head>
<body>
<script type="text/javascript">
/*
var email = prompt("请输入电子邮箱地址","xiaozhanga4@gmail.com");
document.write( email.indexOf("@"));
document.write( "<br/>" );
document.write( email.substring(3,10));
*/

/*
var date = new Date();
document.write( date );
document.write( "<br/>" );
document.write( date.getTime() );

var cndate = date.getFullYear() + "年" +
(date.getMonth() + 1) + "月" +
date.getDate() + "日" + "\n" +
date.getHours() + ":" +
date.getMinutes() + ":" +
date.getSeconds();
alert( cndate );
*/

document.write(Math.PI);
document.write(
"<br/>");

document.write(Math.round(
0.999999 * 9 ) + 1 );
document.write(
"<br/>");

document.write(Math.round(
0.001 * 9 ) + 1 );
document.write(
"<br/>");

document.write( Math.round(Math.random()
* 9) + 1 );



</script>
</body>
</html>



原文地址:https://www.cnblogs.com/xiaozhanga4/p/2398095.html