arc_web_tips 青旅半醒 2022-06-05 08:20 155阅读 0赞 **AddOptWiFiList()** function AddOptWiFiList() { var f=document.tF0; //var dev_name, dev_mac,dev_interface; f.wifilist.options.add(new Option("User-WIFI","100")); f.wifilist.options.add(new Option("Guest-WIFI","116")); } <form name="tF0" action="/cgi-bin/wireless_eb.exe" method="post" target="OUTfrm"> <table width="98%" border="0" cellspacing="3" cellpadding="5"> <tr> <td class="normalTextRight"><font class="arcFont2" id="274">WIFI:</font></td> <td class="tdTextBt_20" colspan="2"> <select name="wifilist" id="wifilist" size="1" onChange="wifi_select_onchange()"> </select> </td> </tr> -------------------- **checkbox 选中 取消** <input type="checkbox" name="schedule" id="week_1" value="0" onClick=""> $("#week_1").attr("checked",true); or document.getElementById("week_7").checked = true; or EnableObject("week_2"); EnableObject("week_3"); EnableObject("week_4"); 取消 <input type="checkbox" > $("input:checkbox").removeAttr("checked"); //input里面的checkbox类型 or $("#week_1").removeAttr("checked"); $("#week_2").removeAttr("checked"); $("#week_3").removeAttr("checked"); $("#week_4").removeAttr("checked"); $("#week_5").removeAttr("checked"); $("#week_6").removeAttr("checked"); $("#week_7").removeAttr("checked"); function EnableObject(id){ var obj=null; if("string" == typeof(id)){ obj=document.getElementById(id); }else{ obj=id; } if(obj){ obj.disabled=false; try{ $(obj).jqDisabled(false); }catch(e){} } } function DisableObject(id){ var obj=null; if("string" == typeof(id)){ obj=document.getElementById(id); }else{ obj=id; } if(obj){ obj.disabled=true; try{ $(obj).jqDisabled(true); }catch(e){} } } **隐藏,显示By ID** function DisplayObject(id){ if(document.getElementById(id)){ document.getElementById(id).style.display=""; document.getElementById(id).style.visibility="visible"; } } function HiddenObject(id){ if(document.getElementById(id)){ document.getElementById(id).style.display="none"; document.getElementById(id).style.visibility="hidden"; } } -------------------- checkbox 判断是否选中 if ( $(week_1).is(":checked") == true){ var Mon = "1";} if ( $(week_2).is(":checked") == true){ var Tus = "1";} if ( $(week_3).is(":checked") == true){ var Wen = "1";} if ( $(week_4).is(":checked") == true){ var Thu = "1";} if ( $(week_5).is(":checked") == true){ var Fri = "1";} if ( $(week_6).is(":checked") == true){ var Sta = "1";} if ( $(week_7).is(":checked") == true){ var Sun = "1";} -------------------- **选中select值** if(config_wifi_name == "guest") { $("#wifilist").val("116");//guest } else { $("#wifilist").val("110");//user } DisableObject("wifilist"); or document.getElementById("starttime_h").selectedIndex=config_st_h; \*\*获取select的选中的项的val 获取select 选中的 text\*\* var interface_mode_select_val = $("#interface_mode_select ").val(); var interface_mode_select_number_val = $("#interface_mode_select_number ").val(); $("#ddlregtype").find("option:selected").text(); -------------------- **获取当前url** var thisURL = document.URL; var checkUrlAddOrEdite=thisURL.split('?date=')[1]; //guest_21709_0011000_14400_19500 check_url_wifi_date = checkUrlAddOrEdite.split('_'); var config_wifi_name = check_url_wifi_date[0]; var config_id = check_url_wifi_date[1]; var config_day = check_url_wifi_date[2]; var config_st = check_url_wifi_date[3]; var config_et = check_url_wifi_date[4]; -------------------- jquery判断checked的三种方法: .attr('checked): //看版本1.6+返回:”checked”或”undefined” ;1.5-返回:true或false .prop('checked'): //16+:true/false .is(':checked'): //所有版本:true/false//别忘记冒号哦 jquery赋值checked的几种写法: 所有的jquery版本都可以这样赋值: // $("#cb1").attr("checked","checked"); // $("#cb1").attr("checked",true); jquery1.6+:prop的4种赋值: // $("#cb1″).prop("checked",true);//很简单就不说了哦 // $("#cb1″).prop({checked:true}); //map键值对 // $("#cb1″).prop("checked",function(){ return true;//函数返回true或false }); //记得还有这种哦:$("#cb1″).prop("checked","checked"); if ( $(schedule_enable_id).is(":checked") == true){ var schedule_enable = 1;}
还没有评论,来说两句吧...