Using Dynamic HTML Var Name to build Dynamic Java/jsp var names

    Date: 01/14/05 (Javascript Community)    Keywords: html, java, jsp

    [Error: Irreparable invalid markup ('') in entry. Owner must fix manually. Raw contents below.]

    I found the solution and follows under the solution cut!

    I have created the following dynamic HTML columns Col1, Col2, ...
    I need to access these named variables and assign them to both a javascript and java/jsp variable.
    Any ideas on how to do this.


    Old Code

    <%for (int x=0; x
    id='HRankCol<%=CurrRank.intValue()%>'
    name=HRankCol<%=CurrRank.intValue()%>
    value ="<%=CurrRank.intValue()%>"/
    >
    id='HRankFillQty<%=CurrRank.intValue()%>'
    name=HRankFillQty<%=CurrRank.intValue()%>
    value ="<%=CurrRank.intValue()+1%>"/
    >
    <%}%>

    JSP current code not working ....

    function fred()
    {
    var f = document.all.frmFixFill;
    for (var x=0; x {
    alert(f.'HRankFillQty'+x.value);
    }
    }



    The new fred function:
    function fred()
    {
    var f = document.all.frmFixFill;
    var fillname = null;
    for (var x=1; x<=f.HiddenRankCntColumns.value; x++)
    {
    fillname = "document.frmFixFill.HRankFillQty" + x + ".value";
    alert(eval(fillname));
    }
    }


    x-posted to and other JSP communities

    Source: http://www.livejournal.com/community/javascript/53149.html

« repeat while mouse down? || Scrollbar help.. »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home