<head runat="server"> <title></title> <script type="text/javascript"> function check() { var completion = 0; if (document.getElementById("field1").value != "") { completion++; } if (document.getElementById("field2").value != "") { completion++; } if (document.getElementById("field3").value != "") { completion++; } document.getElementById("progressbar").style.width = completion * 20 + "px"; } </script> </head> <body> <form id="form1" action="Temp1.aspx" runat="server"> <div> Name: <input type="text" id="field1" onchange="check()" /><br /> Tel No.: <input type="text" id="field2" onchange="check()" /><br /> Email: <input type="text" id="field3" onchange="check()" /><br /> Completion: <div style="width: 60px; height: 10px; border: 1px solid black;"> <div style="width: 0px; height: 10px; background-color: green;" id="progressbar"> </div> </div> <input type="submit" /> </div> </form> </body> </html>
<head runat="server"> <title></title> <script type="text/javascript"> function check() { var completion = 0; if (document.getElementById("field1").value != "") { completion++; } if (document.getElementById("field2").value != "") { completion++; } if (document.getElementById("field3").value != "") { completion++; } document.getElementById("progressbar").style.width = completion * 20 + "px"; } </script> </head> <body> <form id="form1" action="Temp.aspx" runat="server"> <div> <table style="width: 100%;"> <tr> <td> </td> <td> <asp:TextBox ID="field1" runat="server" OnTextChanged="check()" ></asp:TextBox> </td> </tr> <tr> <td> </td> <td> <asp:TextBox ID="field2" runat="server" OnTextChanged="check()"></asp:TextBox> </td> </tr> <tr> <td> </td> <td> <asp:TextBox ID="field3" runat="server" OnTextChanged="check()"></asp:TextBox> </td> </tr> <tr> <td> </td> <td> <asp:TextBox ID="field4" runat="server" OnLoad="check()"></asp:TextBox> </td> </tr> <tr> <td> Completion: <div style="width: 60px; height: 10px; border: 1px solid black;"> <div style="width: 0px; height: 10px; background-color: green;" id="progressbar"> </div> </div> <input type="submit" /> </td> </tr> </table> </div> </form> </body> </html>
asp:TextBox
OnTextChanged
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)