开发者

pass the value in the id="Rate<%=Cnt%>" into showEdit(typ) function to enable it updated in db

开发者 https://www.devze.com 2023-01-20 22:28 出处:网络
<table width=100%> <tr> <td id=\"show1\" class=\"centerNoBorder\">&nbsp;<input type=\"button\" name=\"upd_rate\" value=\"Update Rate\" onclick=\"showEdit(1)\"></td>
<table width=100%>
      <tr>
            <td id="show1" class="centerNoBorder">&nbsp;<input type="button" name="upd_rate" value="Update Rate" onclick="showEdit(1)"></td>
    </tr>
    <tr>
       <td id="show2" style="display:none" class="centerNoBorder">&nbsp;<input type="button" name="upd_rat开发者_JAVA百科e" value="Save" onclick=" updateRate(); showEdit(2)"></td>
    </tr>
</table>    
<td class="leftAlign" valign=top id="rscRate"><div name="bEdit<%=Cnt%>" id="divRate<%=Cnt%>"><%=rscRate%></div><input type="text" id="Rate<%=Cnt%>" name="aEdit<%=Cnt%>" value="<%=rscRate %>" style="display:none"></td>
<td class="leftAlign" valign=top id="rscCost"><div name="bEdit<%=Cnt%>" id="divAm
    function showEdit(typ)
    {
        //alert("showEdit");
        var i=1;
        document.forms[0].reset();
        if(typ==1)
        {
            document.getElementById('show1').style.display='none';  
            document.getElementById('show2').style.display='inline';    
        }
        else
        {   
            document.getElementById('show1').style.display='inline';    
            document.getElementById('show2').style.display='none';  
        }

        while(document.getElementById('rscRate')!=null)
        {

            if(typ==1)//show edit
            {
                //alert("showEdit:" + i);
                //document.getElementById('rscRate').style.display='none';
                //document.getElementById('rscCost').style.display='none';
                document.getElementById('divRate'+i).style.display='none';
                document.getElementById('divAmt'+i).style.display='none';
                document.getElementById('Rate'+ i).style.display='inline';
                document.getElementById('Amt'+ i).style.display='inline';
                document.getElementById('flag').value = 'Y';
                var a = document.getElementById('Rate'+ i).value;
            }
            else //no edit
            {
                //alert("showEdit2");
                //document.getElementById('rscRate').style.display='inline';
                //document.getElementById('rscCost').style.display='inline';
                document.getElementById('divRate'+i).style.display='inline';
                document.getElementById('divAmt'+i).style.display='inline';
                document.getElementById('Rate'+ i).style.display='none';
                document.getElementById('Amt'+ i).style.display='none'; 
                document.getElementById('flag').value ='N'; 
                var a = document.getElementById('Rate'+ i).value;
                //for ( int x = 0; x < i; x ) {

                //}
                //for(var i = 0; i < array.length; i++)
                //document.getElementById.Rate[i].value = array[i];

            }
            i++;        
        }
    }


You should really consider doing this with jQuery.. On the div you can add a onclick event in the document.ready function and then use the value as input in the onclick function. That would solve your problem.

0

精彩评论

暂无评论...
验证码 换一张
取 消