01JS基础2020.3.9

<!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>
发布了40 篇原创文章 · 获赞 3 · 访问量 508

猜你喜欢

转载自blog.csdn.net/weixin_43079958/article/details/105088419