tip:选择策略数据,是否存在安全性问题,如果不安全 恢复之前的select - option
1.
//策略选择判断开始 var policyIndex=0; function clickPolicy(){ var obj2 = document.getElementById("policy"); policyIndex = obj2.selectedIndex; } function changePolicy(){ var num = policyIndex; // var selectVal = $("#policy").val(); //获取选中记录的value值 //var selectText = $("#policy option:selected").text();//获取选中记录的text值 //ajax请求数据 //alert(selectVal+":"+selectText); var para = "" vwf.ajax({ url : namespace + "/getPolicyById.action", data : para, success : function(msg) { if(msg.securityScan=='1'){//非安全 jConfirm('存在危险性漏洞,确认要添加吗?', '确认框', function(r) { if(r){ }else{ var obj = document.getElementById("policy"); obj.options[num].selected = true; } }); } }, waitMsg:"验证漏洞安全性,请稍候..." }); } //策略选择判断结束
2.
//策略选择判断开始 var policyIndex=0; function clickPolicy(){ var obj2 = document.getElementById("policy"); policyIndex = obj2.selectedIndex; } function changePolicy(){ var num = policyIndex; // var selectVal = $("#policy").val(); //获取选中记录的value值 //var selectText = $("#policy option:selected").text();//获取选中记录的text值 //ajax请求数据 //alert(selectVal+":"+selectText); var para = "" vwf.ajax({ url : namespace + "/getPolicyById.action", data : para, success : function(msg) { if(msg.securityScan=='1'){//非安全 jConfirm('存在危险性漏洞,确认要添加吗?', '确认框', function(r) { if(r){ }else{ var obj = document.getElementById("policy"); obj.options[num].selected = true; } }); } }, waitMsg:"验证漏洞安全性,请稍候..." }); } //策略选择判断结束
var num = policyIndex;这行代码写不写效果不一样