use javascript

Disclaimer: This article is a blogger original article, shall not be reproduced without the consent of bloggers.

https://blog.csdn.net/qilixiang012/article/details/26688393

The first: node embedded in html

<html>
<body>

<input type="button" onclick="document.body.style.backgroundColor='lavender';"
value="Change background color" />

</body>
</html>


Another: Call method

<html>
<body>

<script>
function ChangeBackground()
{
document.body.style.backgroundColor="lavender";
}
</script>

<input type="button" onclick="ChangeBackground()"
value="Change background color" />

</body>
</html>

Third: Import js file

 <script src=“url” type="text/javascript"></script>


Guess you like

Origin www.cnblogs.com/ldxsuanfa/p/10927015.html