You've no jQuery in there for a start.

Instead of

        var c = document.getElementByID(f);
        c.style.display = "block";


try
             $("#"+f).show();

L

chuck wrote:
I am having some trouble getting some divs to display dynamically. Can
someone please offer a pointer?

-------------------------------------------------
<script type="text/javascript">
function update(x){
        var id = x.selectedIndex;
        var v = x.options[id].value;

        var f = "test" + v;
        var c = document.getElementByID(f);
        c.style.display = "block";
}
</script>


<html>
        <div id="test" style="display:block">
        testing div
        </div>

        <div id="x">
                <select name="t" id="t" onchange="update(this);">
                <option value=1>one</option>
                <option value=2>two</option>
                </select>
        </div>

        <div id="test1" style="display:none">
                this is some stuff
        </div>

        <div id="test2" style="display:none">
                this is some other stuff
        </div>
</html>
-------------------------------------------------
------------------------------------------------------------------------


No virus found in this incoming message.
Checked by AVG - www.avg.com Version: 8.5.387 / Virus Database: 270.13.14/2238 - Release Date: 07/14/09 18:03:00


Reply via email to