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 set the div frame for javascript

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

In this article, the editor introduces in detail "how to set the div frame in javascript". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to set the div frame in javascript" can help you solve your doubts.

Javascript sets the div border by first using "document.getElementById" to get the specified div label object, and then using the "object .style.border =" border width style color "" statement to set the div border.

The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.

Javascript to set the div border:

Get div element object

Use the border property of the Style object to set the border

The border property sets all border properties in one declaration.

Syntax:

The Object.style.border=borderWidth borderStyle borderColor value describes the value borderWidth sets the width of the border.

Thin

Medium

Thick

Length

BorderStyle sets the style of the border.

None

Hidden

Dotted

Dashed

Solid

Double

Groove

Ridge

Inset

Outset

BorderColor sets the color of the border.

Color-name

Color-rgb

Color-hex

Transparent

Example:

Div {padding: 10pxX margin: 10px;} function changeBorder () {document.getElementById ("div1") .style.border = "thin dotted # FF0000";} div element, test text

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

Internet Technology

Wechat

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

12
Report