<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title ></title>
<script>
window.alert(5 + 6);
</script>
<script>
ducument.getElementById("in").innerHTML="我是html输入的语句";
</script>
<script>
document.write(Date());
var a= new Date();
var b=a.getYear();
if(b>7){
document.write("今年shi"+b);
window.alert("b");
}
</script>
<script>
var a=1;
var b=3;
var c=a+b;
console.log(c);
</script>
</head>
<body>
</body>
</html>
第一节javascript的样式设置
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title ></title>
<script>
window.alert(5 + 6);
</script>
<script>
ducument.getElementById("in").innerHTML="我是html输入的语句";
</script>
<script>
document.write(Date());
var a= new Date();
var b=a.getYear();
if(b>7){
document.write("今年shi"+b);
window.alert("b");
}
</script>
<script>
var a=1;
var b=3;
var c=a+b;
console.log(c);
</script>
</head>
<body>
</body>
</html>
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="UTF-8">
- <title ></title>
- <script>
- document.write("<font size=7> 谁在悬崖沏一壶茶 </font>");
- document.write("<body bgcolor='#0000FF' text='red' </body>");
- </script>
- </head>
- <body>
- </body>
- </html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title ></title>
<script>
document.write("<font size=7> 谁在悬崖沏一壶茶 </font>");
document.write("<body bgcolor='#0000FF' text='red' </body>");
</script>
</head>
<body>
</body>
</html>
第二章javascript typeof
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <p> typeof 操作符返回变量、对象、函数、表达式的类型。</p>
- <p id="demo"></p>
- <script>
- document.getElementById("demo").innerHTML =
- typeof "john" + "<br>" +
- typeof 3.14 + "<br>" +
- typeof NaN + "<br>" +
- typeof false + "<br>" +
- typeof [1,2,3,4] + "<br>" +
- typeof {name:'john', age:34} + "<br>" +
- typeof new Date() + "<br>" +
- typeof function () {} + "<br>" +
- typeof myCar + "<br>" +
- typeof null;
- </script>
- </body>
- </html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p> typeof 操作符返回变量、对象、函数、表达式的类型。</p>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML =
typeof "john" + "<br>" +
typeof 3.14 + "<br>" +
typeof NaN + "<br>" +
typeof false + "<br>" +
typeof [1,2,3,4] + "<br>" +
typeof {name:'john', age:34} + "<br>" +
typeof new Date() + "<br>" +
typeof function () {} + "<br>" +
typeof myCar + "<br>" +
typeof null;
</script>
</body>
</html>
第三章javascript的onclick事件
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- </head>
- <body>
- <p> typeof 操作符返回变量或表达式的类型。</p>
- <button onclick="myFunction()">点我</button>
- <p id="demo"></p>
- <script>
- function myFunction() {
- var y = 1;
- var x =2;
- document.getElementById("demo").innerHTML =
- y+ x;
- }
- </script>
- </body>
- </html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<p> typeof 操作符返回变量或表达式的类型。</p>
<button οnclick="myFunction()">点我</button>
<p id="demo"></p>
<script>
function myFunction() {
var y = 1;
var x =2;
document.getElementById("demo").innerHTML =
y+ x;
}
</script>
</body>
</html>