dynamic drop down list in wordpress

  • Author
    Posts
  • #1100413

    pls help me out,
    im trying add dynamic drop down list in wordpress, but failed
    its works fine when executed on browser normally.. but fails when i add it on wordpress pages
    thank you…..

    here is the code

    <script language=”javascript”>
    var arr = new Array();
    arr[0] = new Array(“-select-“);
    arr[1] = new Array(“Maharashtra”,”Karnataka”,”Andhra Pradesh”,”Tamil Nadu”);
    arr[2] = new Array(“Carinthia”,” Styria”);
    arr[3] = new Array(“Florida”,”New York”,”Maryland”);
    arr[4] = new Array(“Queensland”,”Victoria”,”Tasmania”,”New South Wales”);

    function change(combo1){
    var comboValue = combo1.value;
    document.forms[“form”].elements[“combo2”].options.length=0;
    for (var i=0;i<arr[comboValue].length;i++){
    var option = document.createElement(“option”);
    option.setAttribute(‘value’,i+1);
    option.innerHTML = arr[comboValue][i];
    document.forms[“form”].elements[“combo2”].appendChild(option);
    }
    }
    </script>
    <form name=”form” method=”post”><select name=”combo1″ onchange=”change(this);”>
    <option value=”0″>-Select-</option>
    <option value=”1″>India</option>
    <option value=”2″>Austria</option>
    <option value=”3″>USA</option>
    <option value=”4″>Australia</option>
    </option>
    </select>
    <select name=”combo2″>
    </select>
    </form>

    The blog I need help with is anilkumarmudiraj.wordpress.com.

    #1100634

    timethief
    Member

    Users are not allowed to post JavaScript on WordPress.com blogs. The software strips it out for security reasons. http://en.support.wordpress.com/code/#javascript

The topic ‘dynamic drop down list in wordpress’ is closed to new replies.