1 $(document).ready(function () {
  2     $('#radioExtranet').on('click', function () { showProjectInformation() });
  3     $('#radioCorp').on('click', function () { hideProjectInformation() });
  4     $('.add').on("click", function () { addServerIP(this) });
  5     
  6     $("form").submit(function () {
  7 
  8         //if ($("#wo").val() != "")//验证
  9         if (true)//验证ip1~3不为空,ComputerName不为空,Friendly name不为空,pitid&sraid 不为空
 10         {
 11             if ($("#radioExtranet").val() == "Extranet") {
 12                 $.ajax({
 13                     url: "/ScanNow/RadioBtnType",
 14                     type: "Post",
 15                     //dataType: "json",
 16                     data: { TypeName: $("#radioExtranet").val()},
 17                     //success: function (data) {
 18                     //    if (data.wuyang == "1") {
 19                     //        alert(data.wuyang)
 20                     //        alert(data.yangwu);
 21                     //        //location.reload();
 22                     //    } else {
 23                     //        alert(data.yangwu);
 24                     //    }
 25                     //}
 26                 })
 27 
 28             }
 29             else {
 30 
 31             }
 32             return true;
 33         }
 34         else {
 35             alert("Some fields are empty! Please fill in the item.");
 36             
 37             return false;
 38         }
 39 
 40     });
 41 }
 42     );
 43 
 44 function hideProjectInformation() {
 45     $("#tabProjectInformation").hide();
 46     $("#radioCorp").attr('value', 'Corp');
 47     $("#radioExtranet").attr('value', '1');
 48 
 49     
 50 }
 51 function showProjectInformation() {
 52     $("#tabProjectInformation").show();
 53     $("#radioCorp").attr('value', '0');
 54     $("#radioExtranet").attr('value', 'Extranet');
 55 }
 56 
 57 function addServerIP(el) {
 58     var account = $('#iptable').find("tr").length;
 59     var trServerIP = $("#ServerIP1").clone();
 60     trServerIP.attr("id", "ServerIP" + account);
 61     trServerIP.attr("class", "addServerIP");
 62     trServerIP.find(".labServerIP").remove();
 63     trServerIP.find("img").attr("src", "/Content/Images/Add.png");
 64     trServerIP.find("img").attr("title", "add");
 65     trServerIP.find("img").attr("alt", "add");
 66     trServerIP.find("img").attr("class", "add");
 67     
 68     $("#ServerIP"+(account-1)).after(trServerIP);
 69 
 70     $("#ServerIP" + (account - 1)).find("img").attr("src", "/Content/Images/Remove.png");
 71     $("#ServerIP" + (account - 1)).find(".add").attr("title", "remove");
 72     $("#ServerIP" + (account - 1)).find(".add").attr("alt", "remove");
 73     $("#ServerIP" + (account - 1)).find(".add").attr("class", "remove");
 74     $('.add').off("click");
 75     $('.add').on("click", function () { addServerIP(this) });
 76     $('.remove').off("click");
 77     $('.remove').on("click", function () { removeServerIP(this) });
 78     
 79 }
 80 function removeServerIP(el) {
 81 
 82     $(el).parent().parent().parent("tr").remove();
 83 
 84     $('.remove').off("click");
 85     $('.remove').on("click", function () { removeServerIP(this) });
 86 
 87     if ($('#iptable').find("tr").length == 2)
 88     {
 89         $("#iptable").find("tr:eq(1)").attr("id", "ServerIP1");
 90         $('#ServerIP1').find("td").first().append("<label class=\"labServerIP\"><strong>Server IP</strong></label>");
 91     }
 92     $('.add').off("click");
 93     $('.add').on("click", function () { addServerIP(this) });
 94 
 95 }
 96 
 97 //
 98 function removePorjectInformation(el) {
 99     var tabProjectInformationTemplate = $('#tabProjectInformationTemplate').clone();
100     if ($('#tabProjectInformation').length == 0)
101     { 
102     tabProjectInformationTemplate.removeAttr('style');
103     tabProjectInformationTemplate.attr('id','tabProjectInformation');
104     }
105     if (el == 'radionBtnExtranet') {
106         $('#radionBtnCorp').attr('checked', false);
107         $('#tabRequestInformation').after(tabProjectInformationTemplate);
108     }
109     else {
110         $('#radionBtnExtranet').attr('checked', false);
111         $('#tabProjectInformation').remove();
112     }
113     
114     
115 }
View Code

相关文章: