javaScript输出数据

  1. javaScript输出数据
    • document,write(“可以向body中输出内容”) 可以向body中输出内容
    • console.log(“向控制台输出内容”) 向控制台输出内容
    • alert(“向控制台输出内容”) 浏览器弹出窗口

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Document</title>
</head>
<script>
var name=prompt("请在键盘输入名字:");
console.log(name);
alert(name);
document.getElementById("info").innerHTML=document.write("可以向body中输出内容");
</script>
<body>
<h1>标题</h1>
<p id="info"></p>
</body>
</html>

 

posted @ 2020-12-29 11:58  ITWebGirl  阅读(73)  评论(0)    收藏  举报