当前位置:网站首页>JS basic learning script

JS basic learning script

2022-06-11 08:10:00 .---

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>day1demo4</title>
    <script> function myFunction(){
       document.getElementById("clickOne").innerHTML=" My first one  JavaScript  function "; } </script>
</head>
<body>

<h1> my  Web  page </h1>
<p id="clickOne"> A paragraph .</p>
<button type="button" onclick="myFunction()"> Click here </button>

</body>
</html>

script It will be called directly at run time , But the functions inside need to be operated and called by ourselves
For example, here we click the button to realize myFunction Function and then Id by clickOne The label of changes its content

原网站

版权声明
本文为[.---]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206110803561591.html