hsfrey ha scritto:
function togl(b1) {
var t1 = document.getElementById(b1).getElementsByTagName("input");
var labl = t1[0].value;
t1[0].value = labl=="Hide"?"Show":"Hide";
...
}
In addition, rather than just Match the ID, I want to match the ID
which ENDS in the string contained in b1.
A simple "#"+b1 won't do that, which is why I used ["[id$="+b1="]".
The target of the JS is the html:
<div id="box1" ...>
<input type=button value="Hide" onclick="togl('box1')"/>
...
</div>
If I understood, in your markup the button will have an id like
"something_box1", right?
If you can change your markup, i suggest to you to group elements using
a class. by the way your first code:
$(("[id$="+b1+"]") input).attr(value, attr(value)=="Hide"?"Show":"Hide");
should be
$("[id$="+b1+"] input").val($(this).val()=="Hide"?"Show":"Hide");
Bye
(i've not tested the code, but I think is right :P)
--
gianiaz.net - web solutions
via piedo, 58 - 23020 tresivio (so) - italy
+39 347 7196482