JavaScript image border

We can add or remove border by using JavaScript. Here is the simple code
document.getElementById('i1').border=1;
Here i1 is the image object.
Demo of adding or removing image border.

Here is the code.
<html>
<head>
<title>Demo of Adding or removing border from Image in JavaScript</title>
<link rel="stylesheet" href="../images/all11.css" type="text/css">
<script language='JavaScript' type='text/JavaScript'>
<!--
function add_border(str) {
document.getElementById('i1').border=str;
}
//-->
</script>
</head>
<body>

<img src=images/help.jpg id='i1'>
<br><br><br><br>

<input type=button onClick=add_border('3') value='Add Border'><input type=button onClick=add_border('0') value='Remove Border'>
<br>
</body>
</html>

Managing Alt tag of Image
Image Object
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com










    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer