"oicram" <webforumsuser@macromedia.com> wrote in
message
news:fcc98i$lqo$1@forums.macromedia.com...
> Ok. I ask you to have patience... :s
>
> So I have a PHP counter that will start with the repeat
region, and every
> time
> the repeat region repeats a region the counter adds one.
>
> Then, I have the layers that the counter will dynamicly
change ther name
> by
> doing: Layer<?php echo
> $counter; ?> and this will correspond for the Browser
to layer1 if its the
> first repeat record, layer2 if it is the second record
etc...
>
> After this I don't understand. :(
> I mean, how he will interact with the javascript code?
> I know here:
> a href="#"
onCLick="thisIsJavaScriptThatSoesSomeThingWith('Layer<?php echo
> $counter; ?>');">show/hide</a>
>
> But my javascript code is static.
> I explain:
>
> I cannot use the show / hide available by dreamweaver
because if the
> region is
> hide (he show white space with nothing inside) well I
prefer to quit the
> "white
> space when we make a hide so I use the properties on:
style.display.
>
> The script that I get (don't remember where) to do this
is:
>
> <Script>
> function showDiv() {
>
document.getElementById("div_name").style.display="none";
> }
> </Script>
>
> But with a script like this, no matter what I put in the
repeat region, he
> will always look for the name that I have in this
script, right?
>
> So... I have to put it dynamic, but for that I need to
declare the counter
> before this script. After that can this be something
like:
>
> <Script>
> function showDiv() {
> document.getElementById("div_name<?php echo
> $counter; ?>").style.display="block";
> }
> </Script>
>
> and also to hide:
>
> <Script>
> function hideDiv() {
> document.getElementById("div_name<?php echo
> $counter; ?>").style.display="none";
> }
> </Script>
>
>
> Result, of all this? No errors, but I have a very big
white page with
> nothing
> in there!!!!!
>
>
http://www.cantinho.org/admin/cantinho/find_search_result_v2.php
>
> Please.... have patience and help me out... I'm trying
to learn, but this
> is
> my first steps in code.
>
>
> Thanks a lot.
Okay... Dreamweaver has that other behaviors panel, which
contains a
Show/Hide Layer behavior, try practicing with that,
there's one catch with that behavior, to make it recognize
your relatively
positioned div's you have to add style="position:relative" to
the div.
The handcoding way would be to move your function into the
head of the
document, and give it a parameter for the id of the object it
should operate
on.
<script type="text/javascript">
<!--
function showDiv(id) {
document.getElementById(id).style.display="block";
}
function hideDiv(id) {
document.getElementById(id).style.display="none";
}
//-->
</script>
Then you pass it the id of the object to operate on like this
<a href="#" onCLick="showDiv('Layer<?php echo $counter;
?>');">show</a>
<a href="#" onCLick="hideDiv('Layer<?php echo $counter;
?>');">hide</a>
then again, the Show/Hide layer behavior provides you with UI
integration in
Dreamweaver.
Joris