Home >Web Front-end >JS Tutorial >JS method to allow visitors to choose the text color of web pages by themselves_javascript skills
The example in this article describes the method of using JS to allow visitors to choose the text color of web pages by themselves. Share it with everyone for your reference. The specific implementation method is as follows:
<html> <head> <title>JS实现让访问者自助选择网页的文字颜色</title> <script language="javascript"> <!-- function chColor(c){ document.body.style.color = c; } //--> </script> </head> <body> <input name="c" type="radio" value="#000000" onClick="chColor(this.value)" checked>黑 <input name="c" type="radio" value="#0000FF" onClick="chColor(this.value)">蓝 <input name="c" type="radio" value="#FF0000" onClick="chColor(this.value)">红<br> 本行文字会改变颜色哦! </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.