Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize thickening in javascript

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces how to achieve javascript thickening, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

Javascript to achieve bold methods: 1, using the p tag to create a line of text; 2, by specifying id to get the input object; 3, using the button tag to create a button; 4, by implementing the addbold function to achieve bold text.

This article operating environment: windows7 system, javascript1.8.5 version, Dell G3 computer.

How to thicken javascript?

Js controls text bold:

Create a new html file, named test.html, to explain how to control text bold in js.

Within the test.html file, use the p tag to create a line of text that reads "this is the text for the test".

In the test.html file, set the id of the p tag to myid, which is mainly used to obtain the input object through this id.

Within the test.html file, use the button tag to create a button with the name "text bold".

In the test.html file, bind the onclick click event to the button button, and execute the addbold () function when the button is clicked.

In the js tag, create the addbold () function. Within the function, use the getElementById () method to get the p tag object through id (myid), and set the value of the fontWeight attribute under its style to bolder, so as to achieve bold text.

Open the test.html file in the browser and click the button to see the effect of the implementation.

Thank you for reading this article carefully. I hope the article "how to achieve javascript thickening" shared by the editor will be helpful to everyone. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

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.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report