第一段JavaScript程式碼

hamimelon2020發表於2020-10-12
<!DOCTYPE html>
<html>
 
<head>
<script>
function myFunction()
{
  console.log("hello world");
  document.getElementById("demo").innerHTML="My First JavaScript Function";
  alert("this is a place where can write code.");
}
</script>
</head>
 
<body>
 
<h1>My Web Page</h1>
 
<p id="demo">A Paragraph</p>
 
<button type="button" onclick="myFunction()">Try it</button>
 
</body>
</html>

out:

在http://localhost:52330/a.html 地址瀏覽器中
呈現

My Web Page
A Paragraph

Try it(這個是按鈕)

相關文章