$ (Function (){
$ ("# Addip"). Click (function (){
VaR $ beginip1 = $ ("# s_ip_1"). Val ();
VaR $ beginip2 = $ ("# s_ip_2"). Val ();
VaR $ beginip3 = $ ("# s_ip_3"). Val ();
VaR $ beginip4 = $ ("# s_ip_4"). Val ();
VaR $ endip1 = $ ("# e_ip_1"). Val ();
VaR $ endip2 = $ ("# e_ip_2"). Val ();
VaR $ endip3 = $ ("# e_ip_3"). Val ();
VaR $ endip4 = $ ("# e_ip_4"). Val ();
VaR $ beginip = $ beginip1 + "." + $ beginip2 + "." + $ beginip3 + "." + $ beginip4;
VaR $ endip = $ endip1 + "." + $ endip2 + "." + $ endip3 + "." + $ endip4;
// Check the IP address segment
If ($ beginip1> $ endip1 ){
Alert ("Starting IP address cannot be greater than ending IP Address ");
}
// Verify whether the database exists
// Select Options
If ($ ("# ip_type: checked"). Val () = "1 "){
// Ip segment
$ ("# Limit_ip_list"). append ("<option value = '" + $ beginip + "~ "+ $ Endip +" '> "+ $ beginip + "~ "+ $ Endip +" </option> ");
} Else {
$ ("# Limit_ip_list"). append ("<option value = '" + $ beginip + "'>" + $ beginip + "</option> ");
}
});
});
<Table cellpadding = "0" cellspacing = "0" border = "0">
<Tr>
<TD colspan = "2"> <input type = "radio" name = "ip_type" id = "ip_type" value = "1" Checked = "checked"/>
IP segment
<Input type = "radio" name = "ip_type" id = "ip_type" value = "0"/>
IP value </TD>
<TD> List of restricted IP addresses </TD>
<TD> </TD>
</Tr>
<Tr>
<TD> <input name = "s_ip_1" id = "s_ip_1" type = "text" size = "4" value = "192">
.
<Input name = "s_ip_2" id = "s_ip_2" type = "text" size = "4" value = "168"/>
.
<Input name = "s_ip_3" id = "s_ip_3" type = "text" size = "4" value = "0"/>
.
<Input name = "s_ip_4" id = "s_ip_4" type = "text" size = "4" value = "0"/> </TD>
<TD rowspan = "3"> <input type = "button" name = "addip" id = "addip" value = "=>"/> </TD>
<TD rowspan = "3"> <Select style = "width: 230px" size = "5" multiple = "multiple" id = "limit_ip_list" name = "limit_ip_list">
<Option value = "192.168.1.0 ~ 192.168.1.255 "> 192.168.1.0 ~ 192.168.1.255 </option>
<Option value = "192.168.0.100"> 192.168.0.100 </option>
</SELECT> </TD>
<TD rowspan = "3"> double-click to delete <br/>
<Input type = "button" name = "delip" id = "delip" value = "delete select"/> </TD>
</Tr>
<Tr>
<TD align = "center" bgcolor = "# ffffff"> ~ </TD>
<TD> </TD>
</Tr>
<Tr>
<TD bgcolor = "# ffffff"> <input name = "e_ip_1" id = "e_ip_1" type = "text" size = "4" value = "192">
.
<Input name = "e_ip_2" id = "e_ip_2" type = "text" size = "4" value = "168"/>
.
<Input name = "e_ip_3" id = "e_ip_3" type = "text" size = "4" value = "0"/>
.
<Input name = "e_ip_4" id = "e_ip_4" type = "text" size = "4" value = "0"/> </TD>
<TD> </TD>
</Tr>
</Table>