The example in this article describes how to use JS to change the background color of a web page by sliding the mouse over a link. Share it with everyone for your reference, the details are as follows:
This little special effect is very good. Use a link to change the background color of the web page. Place the mouse on the link text, and the background of the web page will change accordingly. Friends who want to make your homepage more personalized, this code can definitely be used. In fact, you can On this basis, you can modify the code and change it to switch the style sheet by placing the mouse on the text. In this way, the entire web page will change the style. Isn't it very practical?
The screenshot of the running effect is as follows:
The online demo address is as follows:
http://demo.jb51.net/js/2015/js-mouse-over-link-cha-bgcolor-demo/
The specific code is as follows:
<html> <head> <title>鼠标放上链接改变网页背景颜色</title> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <SCRIPT LANGUAGE="JavaScript"> function goHist(a) { history.go(a); } </script> </head> <body> <center> <h2>鼠标放到相应链接上看看!</h2> <table border=1 borderlight=green style="border-collapse: collapse" cellpadding="5" cellspacing="0"> <tr><td align=center> <a href="#" onMouseOver="document.bgColor='skyblue'">天空蓝</a> <a href="#" onMouseOver="document.bgColor='red'">大红色</a> <a href="#"onMouseOver="document.bgColor='#0066CC'">清新蓝</a> </td></tr> </table> </center> </body> </html>
I hope this article will be helpful to everyone in JavaScript programming.