Does anyone know how on earth I could attempt this? ?
Add Javascript to the web page to create a thick border around each image when a button is pressed. Add another button which when pressed clears the border. ๐ฎ
@mrhooNov 28.2007 โย #To prevent the images from 'twitching' I would give them a transparent border by default and set a border-color when you select the border 'on' button.
You can collect all the images with getElementsByTagName('img') and loop through them individually. Or you can edit a style sheet and replace the img selector's rule(s).
@nap0leonNov 30.2007 โย #In the example below, when "Turn Borders ON" is clicked, the SetClass function locates the element on the page with ID="someID" and sets the class of that DIV to "borders_on".
create 2 classes in your CSS file
(this example sets the border to white to match the page background color) [CODE].borders_off{border:1px solid #FFFFFF;} .borders_on{border:1px solid #000000;}[/CODE]
create a javascript function [CODE]function SetClass(classname, imgID){ var Element=document.getElementById(imgID); Element.class=classname; } [/CODE]
create an image on your page [CODE]<img src="picture.gif" class="borders_off" id="someID"/>[/CODE]
@talksrauthorDec 02.2007 โย #Thanks for the help it worked well.
But when I add another picture picture2.gif, it only adds a border to the first gif. Why is this?
Here is the code..
[code=html]<!-- index.html --> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Coursework</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link href="css.css" rel="stylesheet" type="text/css">
<script type="text/javascript"> function SetClass(classname, imgID){ var Element=document.getElementById(imgID); Element.className=classname; } </script>
@FangDec 02.2007 โย #The previous solution was for 1 image not for any number of images. function SetClass(){ for (var i=1, el; el = document.getElementById(arguments[i]); i++) { el.className=arguments[0]; } <br/> }