<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- 在HTML中 -->
<h1 id="1">HELLO WORLD</h1>
<!-- JS语言运用要通过script标签定义
1.通过window.alert(); 弹窗输出
2.通过write写入一个h1标签
3.innerHTML方法来修改其中内容
4.输出控制台日志
-->
<script>
// 弹出警告框 最基本输出方式
window.alert("HELLO WORLD");
// 方法二
document.write("<h1>helloworld</h1>");
// 方法三
document.getElementById("1").innerHTML="hello xueshihao";
// 方法四
console.log("hello world@@");
// 单行注释和块注释/* */
</script>
</body>
</html>
javascript之——01JS基础2020.3.9
最新推荐文章于 2020-03-26 21:11:29 发布