English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Expand / Collapse an image in the onclick event can be made in javascript. Can I implement this in CSS means can I handle the onclick event in css?

2007-03-22 18:43:07 · 3 answers · asked by Anonymous in Computers & Internet Programming & Design

3 answers

CSS2 added :focus , the item that has been chosen (by a click or tab)

so

.magic { display:none}
:focus .magic { display:block}

should get you in the correct direction!

it show the magic div when the enclosing div is focused.

I haven't tried it but that what I get from

http://www.w3.org/TR/REC-CSS2/selector.html#dynamic-pseudo-classes


PS even if you could do the previous suggestion (I don't think you can) it would call javascript functions!

2007-03-22 20:24:32 · answer #1 · answered by jake cigar™ is retired 7 · 1 0

Yes.
You write it fairly similarly.

DIV.header > H1.TOCtitle {
color : red ;
onclick : "fold_or_unfoldTOC(event)"
}

These are what you can currently use:
onload = script
onunload = script
onclick = script
ondblclick = script
onmousedown = script
onmouseup = script
onmouseover = script
onmousemove = script
onmouseout = script
onfocus = script
This attribute may be used with the following elements: A, AREA, LABEL, INPUT, SELECT, TEXTAREA, and BUTTON.
onblur = script
It may be used with the same elements as onfocus.
onkeypress = script
onkeydown = script
onkeyup = script
onsubmit = script
It only applies to the FORM element.
onreset = script
It only applies to the FORM element.
onselect = script
This attribute may be used with the INPUT and TEXTAREA elements.
onchange = script
This attribute applies to the following elements: INPUT, SELECT, and TEXTAREA.

2007-03-23 01:57:09 · answer #2 · answered by ? 5 · 0 0

You can actually do this with just mouseover.
See the following for all sorts of tricks
http://www.cssplay.co.uk/menu/imap.html

2007-03-26 19:35:02 · answer #3 · answered by Tracy L 7 · 0 0

fedest.com, questions and answers