Home > Web Front-end > JS Tutorial > body text

How to hide border lines in JavaScript

青灯夜游
Release: 2022-01-19 13:38:28
Original
3812 people have browsed it

Methods to hide border lines: 1. Use the "document.getElementById("id")" syntax to obtain the specified element node based on the id value; 2. Use "element node.style.borderColor="transparent";" statement to hide the border line of the specified element node.

How to hide border lines in JavaScript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

How to hide the border line in JavaScript

In JavaScript, you can hide the border line by setting the color of the border line to transparent. .

Implementation code:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<style type="text/css">
			div{
				padding: 10px;
				background-color: #FFC0CB;
				border: 2px solid black;
			}
		</style>
	</head>
	<body>
		<div id="box">元素内容</div><br/>
		<button onclick="myFunction()">隐藏边框线</button>
		<script>
			function myFunction() {
				var box=document.getElementById("box");
				box.style.borderColor="transparent";
			}
		</script>
	</body>
</html>
Copy after login

How to hide border lines in JavaScript

[Related recommendations: javascript learning tutorial]

The above is the detailed content of How to hide border lines in JavaScript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template