PDA

View Full Version : Id to child selector in javascript



balkanboy
12-09-2005, 12:38 AM
Hi to all! I am new here and I don't know anything about javasript language, so I need little help. I want to use some javascript image effects (Demo here (http://wiki.script.aculo.us/scriptaculous/show/CombinationEffectsDemo)
After I link javasript files to my html template page, I have to options to achive effects(Link (http://wiki.script.aculo.us/scriptaculous/show/Usage)):

1.
<script type="text/javascript" language="javascript">
// <![CDATA[
Effect.Appear('element_id');
// ]]>
</script>
2.
<div onclick="new Effect.SwitchOff(this)">
Click here if you've seen enough.
</div>
Since my content is generated trough php and I want to apply effects to more images, not only one only way to do it is to apply effect to some child selectors, for example
div.content a img
How should javascript look like to make this possible? I would really appriciate your help.

Kor
12-12-2005, 09:18 AM
to apply effect to some child selectors, for example

Which migh be the structure? Is something like?:

<div id="container">
<img src="">
<img src="">
<img src="">
<img src="">
</div>

or ?

<div id="container">
<div>blah</div>
<div>blah</div>
<div>blah</div>
<div>blah</div>
</div>

It is important to know how you elements are grouped. If there is no way to be grouped, which is their common something? Class, style, some other attribute.?