In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces Javascript how to achieve dynamic style control method, the article introduces in great detail, has a certain reference value, interested friends must read!
Method 1: use the style property to set the
Use the style property to set
Html Code:
Div
Javascript Code:
Var div1 = document.getElementById ("div1"); div1.onclick = function () {/ / modify the style div1.style.border = "1px solid red"; div1.style.width = "200px"; div1.style.fontSize = "200px";} method 2: define the style of the class selector
Define the style of the class selector and set its Class attribute value through the ClassName attribute of the element.
Html Code:
Div2
Css Code:
.d1 {border: 1px solid red; width: 100px; height: 100px;} .d2 {border: 1px solid blue; width: 200px; height: 200px;}
Javascript Code:
Var div2 = document.getElementById ("div2"); div2.onclick = function () {div2.className = "D1";} these are all the contents of the article "how Javascript implements dynamic style control methods". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.