亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Introduction to JavaScript

JavaScript Introduction

JavaScript is the programming language of the Web. All modern HTML pages use JavaScript.


JavaScript is the most popular scripting language on the Internet. This language can be used for HTML and web, and can be widely used on servers, PCs, laptops, tablets, smartphones and other devices .


JavaScript is a scripting language

JavaScript is a lightweight programming language .

JavaScript is programming code that can be inserted into HTML pages.

JavaScript, when inserted into an HTML page, can be executed by all modern browsers.

JavaScript is easy to learn.


Example

Let’s look at a program that turns lights on and off through JavaScript

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
 <title>php中文網(wǎng)(php.cn)</title>
</head>
<body>
<script>
 function changeImage()
 {
 element=document.getElementById('myimage')
 if (element.src.match("580d64d73ed01442"))
 {
 element.src="/upload/course/000/000/006/580d64a8c09d6449.gif";
 }
 else
 {
 element.src="/upload/course/000/000/006/580d64d73ed01442.gif";
 }
 }
</script>
<img id="myimage" onclick="changeImage()"
 src="/upload/course/000/000/006/580d64a8c09d6449.gif" width="100" height="180">
<p>點(diǎn)擊燈泡就可以打開或關(guān)閉這盞燈</p>
</body>
</html>

Run the program and try it



Continuing Learning
||
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> </head> <body> <script> function changeImage() { element=document.getElementById('myimage') if (element.src.match("580d64d73ed01442")) { element.src="https://img.php.cn/upload/course/000/000/006/580d64a8c09d6449.gif"; } else { element.src="https://img.php.cn/upload/course/000/000/006/580d64d73ed01442.gif"; } } </script> <img id="myimage" onclick="changeImage()" src="https://img.php.cn/upload/course/000/000/006/580d64a8c09d6449.gif" width="100" height="180"> <p>點(diǎn)擊燈泡就可以打開或關(guān)閉這盞燈</p> </body> </html>
submitReset Code