javascript輸出: javascript通過不同的方式來顯示數據: (1)windows.alert()彈出警告框; (2)document.write()將方法寫入HTML文檔中; (3)innerHTML寫入到HTML元素; ...
javascript輸出:
javascript通過不同的方式來顯示數據:
(1)windows.alert()彈出警告框;
(2)document.write()將方法寫入HTML文檔中;
(3)innerHTML寫入到HTML元素;
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>顯示方式</title>
</head>
<body>
<p id="demo">第一個段落</p>
<script type="text/javascript">
document.write(Date());
document.getElementById("demo").innerHTML="段落已修改";
</script>
</body>
</html>