Click to See Complete Forum and Search --> : Change border style around an image?


pkng
07-20-2009, 04:07 PM
Hi again,

This question should perhaps be in the javascript part, but it's about css too.

If I have a style with 1 px solid #ebebeb connected to an image, could I in a javascript change the style of the border to a dashed line or change the color?

Thanks!

Andyram2k
07-20-2009, 04:20 PM
Hi pkng,
Yeah, this should probably be in the Javascript part, but the defining of the border is CSS.

All you would need is something along the lines of:

<img id="test" src="testimage.jpg" width="100" height="100" />
<script type="text/javascript">
document.getElementById("test").style.border="#000000 10px solid";
</script>

Hope this helps.