Forum Moderators: open

Message Too Old, No Replies

Is there a javascript for . . .

         

mordie

12:35 am on Mar 21, 2005 (gmt 0)

10+ Year Member



...eliminating the box surrounding an image after it has been clicked? I seem to remember seeing one years back.

If so, what is is called? Where to find it?

Rambo Tribble

2:25 am on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I suspect CSS will provide better tools for this task. Try the pseudo-classes, :link, :visited, :hover, and :active. :visited, in particular, and its border properties would seem relevant.

lovethecoast

2:27 am on Mar 21, 2005 (gmt 0)

10+ Year Member



onclick="this.borderStyle = 'none'"

orion_rus

8:16 am on Mar 21, 2005 (gmt 0)

10+ Year Member



onclick=this.style.border='0px solid'

kaled

9:09 am on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm no CSS guru, but you could try the following

a:visited img { border-width:0px; padding:1px }

Adjusting the padding as well as the border should ensure that the image doesn't move when it is clicked.

Kaled.

Rambo Tribble

2:01 pm on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, I think you could probably just do this and get what you want:

a img{border-style:none;}

Note that, on some browsers, none of this will affect the thin, dashed border which displays to indicate an element has focus. There is a :focus pseudo-class, but it is said to be poorly supported. If this is the border you wish to negate, I would suggest the addition of some form of this.blur() to the link, perhaps through the onclick event, either through attribute or handler.

lovethecoast

3:09 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



CSS is great -- but not for hiding a border AFTER someone clicks on an image (unless you use jscript to change the class name or other style attributes).

You want a custom made border to go away after someone clicks on it and javascript is the only way of accomplishing that outside of using css hoover, visited hack (which is also javascript).

Rambo Tribble

4:35 pm on Mar 21, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Curious. For me, the CSS above prevents any border on a linked image before, during, or after activation with Moz, IE or Opera on Win XP Pro. On Win 98, IE leaves the focus() border, but that's it.

lovethecoast

5:11 pm on Mar 21, 2005 (gmt 0)

10+ Year Member



Rambo's reply got me to re-read and I think I misread it to begin with.

If you're talking about the focus box that appears on images, submit buttons, etc, etc, then ONCLICK="this.blur()" will solve that problem.

There may be a CSS solution for that, but I haven't heard of one.