javascript

[toc]

一、input 输入控件,怎样提示其内容为空

1、文件上传控件

A、一种实现方法,案例

html 代码:

<input type="file" id="reportXML" name="reportXML" title="输入内容" multiple="multiple">
<button type="button" onclick="submitXML()">提交</button>

js 代码:

function submitXML(){
    var fileInput = $('#reportXML').get(0).files[0];
    console.info(fileInput);
    if(fileInput) {
        $("#reportXMLform").submit();
    } else {
        alert("请选择上传文件!");
    }
}

B、案例2,在别的 btn-click 里面提交

html 代码如下

<form id="xx" method="post" action="proc.html">
    <input type="file" id="reportXML" name="reportXML" title="输入内容" multiple="multiple">
</form>

js 如下

function submitXML(){
     var fileInput = $('#reportXML').get(0).files[0];
     console.info(fileInput);
     if(fileInput) {
         $("#xx").submit();  //这里利用的是<form>控件的submit功能
     } else {
         alert("请选择上传文件!");
     }
}

2、普通文件框控件

js 代码:

function btnck() {
    var a=document.getElementById("text");
    var b=document.getElementById("btn");
    if(a.value==""){
        alert("文本框内容不能为空!");
    } else {
        alert("提交成功!");
    }
}

html 代码

<input id="text" type="text" />
<input id="btn" type="button" onclick="btnck();" value="提交" />

二、按钮点击之后,3秒内不能再次点击

html 代码

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title> 
    <script type="text/javascript">
        var date1 = new Date();
        var date2 = new Date();
        var data3 = new Date();
        var count = 1;
        function test() {
            date1 = date2;
            date2 = new Date();
            if(count==1) {
                count ++;
            } else {
                data3 = (date2.getTime()-date1.getTime())/1000;
            }
            if (data3 <3) {
                alert("请不要太快添加");
            } else {
                alert("OK");
            }
        }
    </script>
</head>
<body>
    <input type="button" οnclick="test();" value="点我" >
</body>
</html>

三、js实现全国31省市级联下拉选择框核心代码

1、例一,讲述思路

<html>
<head>
<script>
    //底层数据源
    var pro=['黑龙江','吉林','辽宁'];
    //次级数据源要使用二维数组
    var city=[['哈尔滨','佳木斯','齐齐哈尔','大庆','鹤岗'],['长春','四平','松原','吉林'], ['铁岭','大连','沈阳']];
    function init() {
        loadpro();
        loadCity();
    }
    //加载省级的选择函数 
    /*思路:在省级的select中加入option选项
    *实现:找到provice选择框->创建option并加入select中
    *   ->加入数量内容(.innerHTML)由数据源决定(循环)
    *   ->先写入内容再添加到父级标签select中
    */
    function loadpro() {
      var provice = document.getElementById('provice');
      for (var i = 0; i < pro.length; i++ ) {
        var option=document.createElement('option')
        option.innerHTML=pro[i]
        provice.appendChild(option);
      }
    }
    //加载城市的选择函数
    /*思路:在所选省级下的select中加入option城市            *实现:确认当前选择省级(确认索引):
      1.找到省级的select中的值(value)
      2.将当前值与第i个省级对比(确认索引)

      加入城市数据源中的第i组数据option:
      1.找到城市select
      2.循环第i组数据加入(数量:二维长度)              *注意:没选择一次要清空城市选择框中的内容              */
    function loadCity() {
        //找到select provi懈ce
        var provice=document.getElementById('provice');
        var c=document.getElementById('city');
        c.innerHTML='';
        for(var i=0;i<pro.length; i++) {
            if(pro[i]==provice.value) {
                var cs=city[i];
                for(var j=0;j<cs.length;j++) {
                    var option = document.createElement('option');
                    option.innerHTML=cs[j];
                    c.appendChild(option);
                }
            }
        }
    }
    //选择框
    </script>
    </head>
    <body onload="init()">
        <select id="provice" onchange="loadCity()">
        </select>==<select id = "city"></select>
    </body>
</html>

2、例二,一个完全可用的例子

A、源码如下

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>全国省份城市级联下拉菜单</title>
<script language="javascript">
cityareaname=new Array(35);
cityareacode=new Array(35);
function first(preP,preC,formname,selectP,selectC)
{
    a=0;
    if (selectP=='01') {
        a=1;
        tempoption = new Option('北京','01',false,true);
    } else {
        tempoption = new Option('北京','01'); 
    }
    eval('document.'+formname+'.'+preP+'.options[1]=tempoption;');
    cityareacode[0]=new Array('0101','0102','0103','0104','0105','0106','0107','0108');
    cityareaname[0]=new Array('东城区','西城区','崇文区','宣武区','朝阳区','海淀区','丰台区','石景山');
    if (selectP=='02') {
        a = 2;
        tempoption = new Option('深圳','02',false,true);
    } else {
        tempoption = new Option('深圳','02');
    }
    eval('document.'+formname+'.'+preP+'.options[2]=tempoption;');
    cityareacode[1]=new Array('0201','0202','0203','0204','0205','0206');
    cityareaname[1]=new Array('罗湖','福田','南山','盐田','宝安','龙岗');
    if (selectP=='03') {
        a = 3;
        tempoption = new Option('上海','03',false,true);
    } else {
        tempoption = new Option('上海','03');
    }
    eval('document.'+formname+'.'+preP+'.options[3]=tempoption;');
    cityareacode[2] = new Array('0301','0302','0303','0304','0305','0306','0307','0308','0309','0310','0311','0312','0313','0314','0315','0316','0317','0318','0319','0320');
    cityareaname[2]=new Array('宝山','金山','南市','长宁','静安','青浦','崇明','卢湾','松江','奉贤','浦东','杨浦','虹口','普陀','闸北','黄浦','闵行','徐汇','嘉定','南汇');
    if (selectP=='04') {
        a=4;tempoption=new Option('重庆','04',false,true);
    } else {
        tempoption = new Option('重庆','04'); 
    }
    eval('document.'+formname+'.'+preP+'.options[4]=tempoption;');
    cityareacode[3]=new Array('0401','0402','0403','0404','0405','0406');
    cityareaname[3]=new Array('渝中','江北','沙坪坝','南岸','九龙坡','大渡口');
    if (selectP=='05') {
        a = 5;
        tempoption = new Option('天津','05',false,true);
    } else {
        tempoption = new Option('天津','05');
    }
    eval('document.'+formname+'.'+preP+'.options[5]=tempoption;');
    cityareacode[4]=new Array('0501','0502','0503','0504','0505','0506','0507','0508','0509','0510','0511','0512','0513','0514','0515');
    cityareaname[4]=new Array('和平','河北','河西','河东','南开','红桥','塘沽','汉沽','大港','东丽','西青','津南','北辰','武清','滨海');
    if (selectP=='06') {
        a = 6;tempoption=new Option('广东','06',false,true); 
    } else {
        tempoption = new Option('广东','06');
    }
    eval('document.'+formname+'.'+preP+'.options[6]=tempoption;');
    cityareacode[5]=new Array('0601','0602','0603','0604','0605','0606','0607','0608','0609','0610','0611','0612','0613','0614','0615');
    cityareaname[5]=new Array('广州','珠海','中山','佛山','东莞','清远','肇庆','阳江','湛江','韶关','惠州','河源','汕尾','汕头','梅州');
    if (selectP=='07') {
        a = 7;
        tempoption = new Option('河北','07',false,true);
    } else {
        tempoption = new Option('河北','07');
    }
    eval('document.'+formname+'.'+preP+'.options[7]=tempoption;');
    cityareacode[6]=new Array('0701','0702','0703','0704','0705','0706','0707','0708','0709','0710','0711');
    cityareaname[6]=new Array('石家庄','唐山','秦皇岛','邯郸','邢台','张家口','承德','廊坊','沧州','保定','衡水');
    if (selectP=='08') {
        a = 8;
        tempoption=new Option('山西','08',false,true);
    } else {
        tempoption=new Option('山西','08');
    }
    eval('document.'+formname+'.'+preP+'.options[8]=tempoption;');
    cityareacode[7]=new Array('0801','0802','0803','0804','0805','0806','0807');
    cityareaname[7]=new Array('太原','大同','阳泉','朔州','长治','临汾','晋城');
    if (selectP=='09') {
        a = 9;
        tempoption = new Option('内蒙古','09',false,true);
    } else {
        tempoption=new Option('内蒙古','09');
    }
    eval('document.'+formname+'.'+preP+'.options[9]=tempoption;');
    cityareacode[8]=new Array('0901','0902','0903','0904','0905','0906','0907','0908','0909','0910','0911');
    cityareaname[8]=new Array('呼和浩特','包头','乌海','临河','东胜','集宁','锡林浩特','通辽','赤峰','海拉尔','乌兰浩特');
    if (selectP=='10') {
        a=10;tempoption=new Option('辽宁','10',false,true);
    } else { 
        tempoption=new Option('辽宁','10');
    }
    eval('document.'+formname+'.'+preP+'.options[10]=tempoption;');
    cityareacode[9]=new Array('1001','1002','1003','1004','1005','1006','1007','1008','1009','1010','1011','1012','1013','1014');
    cityareaname[9]=new Array('沈阳','大连','鞍山','锦州','丹东','盘锦','铁岭','抚顺','营口','辽阳','阜新','本溪','朝阳','葫芦岛');
    if (selectP=='11') {
        a=11;tempoption=new Option('吉林','11',false,true);
    } else {
        tempoption=new Option('吉林','11');
    }
    eval('document.'+formname+'.'+preP+'.options[11]=tempoption;');
    cityareacode[10]=new Array('1101','1102','1103','1104','1105','1106','1107','1108','1109');
    cityareaname[10]=new Array('长春','吉林','四平','辽源','通化','白山','松原','白城','延边');
    if (selectP=='12') {
        a=12;tempoption=new Option('黑龙江','12',false,true);
    } else {
        tempoption=new Option('黑龙江','12');
    }
    eval('document.'+formname+'.'+preP+'.options[12]=tempoption;');
    cityareacode[11]=new Array('1201','1202','1203','1204','1205','1206','1207','1208','1209','1210','1211','1212','1213');
cityareaname[11]=new Array('哈尔滨','齐齐哈尔','牡丹江','佳木斯','大庆','伊春','黑河','鸡西','鹤岗','双鸭山','七台河','绥化','大兴安岭');
    if (selectP=='13') {
        a=13;tempoption=new Option('江苏','13',false,true);
    } else {
        tempoption=new Option('江苏','13');
    }
    eval('document.'+formname+'.'+preP+'.options[13]=tempoption;');
    cityareacode[12]=new Array('1301','1302','1303','1304','1305','1306','1307','1308','1309','1310','1311','1312','1313');
    cityareaname[12]=new Array('南京','苏州','无锡','常州','镇江','连云港 ','扬州','徐州 ','南通','盐城','淮阴','泰州','宿迁');
    if (selectP=='14') {
        a=14;tempoption=new Option('浙江','14',false,true);
    } else {
        tempoption=new Option('浙江','14');
    }
    eval('document.'+formname+'.'+preP+'.options[14]=tempoption;');
    cityareacode[13]=new Array('1401','1402','1403','1404','1405','1406','1407','1408','1409','1410','1411');
    cityareaname[13]=new Array('杭州','湖州','丽水','温州','绍兴','舟山','嘉兴','金华','台州','衢州','宁波');
    if (selectP=='15') {
        a=15;tempoption=new Option('安徽','15',false,true);
    } else {
        tempoption=new Option('安徽','15');
    }
    eval('document.'+formname+'.'+preP+'.options[15]=tempoption;');
    cityareacode[14]=new Array('1501','1502','1503','1504','1505','1506','1507','1508','1509','1510','1511','1512','1513','1514','1515','1516','1517');
    cityareaname[14]=new Array('合肥 ','芜湖 ','蚌埠 ','滁州 ','安庆 ','六安 ','黄山 ','宣城 ','淮南 ','宿州 ','马鞍山 ','铜陵','淮北 ','阜阳 ','池州 ','巢湖 ','亳州');
    if (selectP=='16') {
        a=16;tempoption=new Option('福建','16',false,true);
    } else {
        tempoption=new Option('福建','16');
    }
    eval('document.'+formname+'.'+preP+'.options[16]=tempoption;');
    cityareacode[15]=new Array('1601','1602','1603','1604','1605','1606','1607','1608','1609');
    cityareaname[15]=new Array('福州 ','厦门 ','泉州 ','漳州 ','龙岩 ','南平 ','宁德 ','莆田 ','三明');
    if (selectP=='17') {
        a = 17;tempoption=new Option('江西','17',false,true);
    } else {
        tempoption=new Option('江西','17');
    }
    eval('document.'+formname+'.'+preP+'.options[17]=tempoption;');
    cityareacode[16]=new Array('1701','1702','1703','1704','1705','1706','1707','1708','1709','1710','1711');
    cityareaname[16]=new Array('南昌','景德镇','九江','萍乡','新余','鹰潭','赣州','宜春','吉安','上饶','抚州');
    if (selectP=='18') {
        a=18;tempoption=new Option('山东','18',false,true);
    } else {
        tempoption=new Option('山东','18');
    }
    eval('document.'+formname+'.'+preP+'.options[18]=tempoption;');
    cityareacode[17]=new Array('1801','1802','1803','1804','1805','1806','1807','1808','1809','1810','1811','1812','1813','1814','1815','1816','1817');
    cityareaname[17]=new Array('济南','青岛','淄博','德州','烟台','潍坊','济宁','泰安','临沂','菏泽','威海','枣庄','日照','莱芜','聊城','滨州','东营');
    if (selectP=='19') {
        a=19;tempoption=new Option('河南','19',false,true);
    } else {
        tempoption=new Option('河南','19');
    }
    eval('document.'+formname+'.'+preP+'.options[19]=tempoption;');
    cityareacode[18]=new Array('1901','1902','1903','1904','1905','1906','1907','1908','1909','1910','1911','1912','1913','1914','1915','1916','1917','1918');
    cityareaname[18]=new Array('郑州','开封','洛阳','平顶山','安阳','鹤壁','新乡','焦作','濮阳','许昌','漯河','三门峡','南阳','商丘','周口','驻马店','信阳','济源');
    if (selectP=='20') {
        a=20;tempoption=new Option('湖北','20',false,true);
    } else {
        tempoption=new Option('湖北','20');
    }
    eval('document.'+formname+'.'+preP+'.options[20]=tempoption;');
    cityareacode[19]=new Array('2001','2002','2003','2004','2005','2006','2007','2008','2009','2010','2011','2012','2013','2014','2015','2016','2017');
    cityareaname[19]=new Array('武汉','黄石','十堰','荆州','宜昌','襄樊','鄂州','荆门','孝感','黄冈','咸宁','恩施','随州','仙桃','天门','潜江','神农架');
    if (selectP=='21') {
        a = 21;
        tempoption = new Option('湖南','21',false,true);
    } else {
        tempoption=new Option('湖南','21');
    }
    eval('document.'+formname+'.'+preP+'.options[21]=tempoption;');
    cityareacode[20]=new Array('2101','2102','2103','2104','2105','2106','2107','2108','2109','2110','2111','2112','2113');
    cityareaname[20]=new Array('长沙','株州','湘潭','衡阳','邵阳','岳阳','常德','郴州','益阳','永州','怀化','娄底','湘西 ');
    if (selectP=='22') {
        a = 22;
        tempoption=new Option('广西','22',false,true);
    } else {
        tempoption = new Option('广西','22');
    }
    eval('document.'+formname+'.'+preP+'.options[22]=tempoption;');
    cityareacode[21]=new Array('2201','2202','2203','2204','2205','2206','2207','2208','2209','2210','2211','2212');
    cityareaname[21]=new Array('南宁','柳州','桂林','梧州','北海','防城港','钦州','贵港','玉林','贺州','百色','河池');
    if (selectP=='23') {
        a = 23;
        tempoption=new Option('海南','23',false,true);
    } else {
        tempoption=new Option('海南','23');
    }
    eval('document.'+formname+'.'+preP+'.options[23]=tempoption;');
    cityareacode[22]=new Array('2301','2302','2303','2304','2305','2306','2307','2308','2309');
    cityareaname[22]=new Array('海口 ','三亚','通什','琼海','琼山','文昌','万宁','东方','儋州');
    if (selectP=='24') {
        a = 24;
        tempoption=new Option('四川','24',false,true);
    } else {
        tempoption=new Option('四川','24');
    }
    eval('document.'+formname+'.'+preP+'.options[24]=tempoption;');
    cityareacode[23]=new Array('2401','2402','2403','2404','2405','2406','2407','2408','2409','2410','2411','2412','2413','2414','2415','2416','2417','2418','2419','2420');
    cityareaname[23]=new Array('成都','自贡','攀枝花','泸州','德阳','绵阳','广元','遂宁','内江','乐山','南充 ','宜宾','广安','达川','巴中','雅安','眉山 ','阿坝 ','甘孜 ','凉山 ');
    if (selectP=='25') {
        a = 25;
        tempoption=new Option('贵州','25',false,true);
    } else {
        tempoption=new Option('贵州','25');
    }
    eval('document.'+formname+'.'+preP+'.options[25]=tempoption;');
    cityareacode[24]=new Array('2501','2502','2503','2504','2505','2506','2507','2508','2509');
    cityareaname[24]=new Array('贵阳 ','六盘水','遵义','铜仁','毕节','安顺','黔西南 ','黔东南','黔南');
    if (selectP=='26') {
        a = 26;
        tempoption = new Option('云南','26',false,true);
    } else {
        tempoption=new Option('云南','26');
    }
    eval('document.'+formname+'.'+preP+'.options[26]=tempoption;');
    cityareacode[25]=new Array('2601','2602','2603','2604','2605','2606','2607','2608','2609','2610','2611','2612','2613','2614','2615','2616','2617');
    cityareaname[25]=new Array('昆明','东川','曲靖','玉溪','昭通','思茅','临沧','保山','丽江','文山 ','红河 ','西双版纳 ','楚雄 ','大理 ','德宏 ','怒江','迪庆');
    if (selectP=='27') {
        a = 27;
        tempoption = new Option('西藏','27',false,true);
    } else { 
        tempoption = new Option('西藏','27');
    }
    eval('document.'+formname+'.'+preP+'.options[27]=tempoption;');
    cityareacode[26]=new Array('2701','2702','2703','2704','2705','2706','2707');
    cityareaname[26]=new Array('拉萨','那曲','昌都','山南','日喀则','阿里','林芝');
    if (selectP=='28') {
        a = 28;
        tempoption=new Option('陕西','28',false,true);
    } else {
        tempoption=new Option('陕西','28');
    }
    eval('document.'+formname+'.'+preP+'.options[28]=tempoption;');
    cityareacode[27]=new Array('2801','2802','2803','2804','2805','2806','2807','2808','2809','2810');
    cityareaname[27]=new Array('西安','铜川','宝鸡','咸阳','渭南','延安','汉中','榆林','商洛','安康');
    if (selectP=='29') {
        a = 29;
        tempoption=new Option('甘肃','29',false,true);
    } else {
        tempoption=new Option('甘肃','29');
    }
    eval('document.'+formname+'.'+preP+'.options[29]=tempoption;');
    cityareacode[28]=new Array('2901','2902','2903','2904','2905','2906','2907','2908','2909','2910','2911','2912','2913','2914');
    cityareaname[28]=new Array('兰州','金昌','白银','天水','嘉峪关','定西','平凉','庆阳','陇南','武威','张掖','酒泉','甘南 ','临夏');
    if (selectP=='30') {
        a = 30;
        tempoption=new Option('青海','30',false,true);
    } else {
        tempoption=new Option('青海','30');
    }
    eval('document.'+formname+'.'+preP+'.options[30]=tempoption;');
    cityareacode[29]=new Array('3001','3002','3003','3004','3005','3006','3007','3008');
    cityareaname[29]=new Array('西宁','海东',' 海北 ','黄南','海南','果洛','玉树','海西');
    if (selectP=='31') {
        a = 31;
        tempoption = new Option('宁夏','31',false,true);
    } else {
        tempoption=new Option('宁夏','31');
    }
    eval('document.'+formname+'.'+preP+'.options[31]=tempoption;');
    cityareacode[30]=new Array('3101','3102','3103','3104');
    cityareaname[30]=new Array('银川','石嘴山','银南','固原');
    if (selectP=='32') {
        a = 32;
        tempoption=new Option('新疆','32',false,true);
    } else {
        tempoption=new Option('新疆','32');
    }
    eval('document.'+formname+'.'+preP+'.options[32]=tempoption;');
    cityareacode[31]=new Array('3201','3202','3203','3204','3205','3206','3207','3208','3209','3210','3211','3212','3213');
    cityareaname[31]=new Array('乌鲁木齐','克拉玛依','石河子','吐鲁番','哈密','和田','阿克苏','喀什','克孜勒苏','巴音郭楞','昌吉','博尔塔拉','伊犁');
    if (selectP=='33') {
        a = 33;
        tempoption=new Option('香港','33',false,true);
    } else {
        tempoption=new Option('香港','33');
    }
    eval('document.'+formname+'.'+preP+'.options[33]=tempoption;');
    cityareacode[32]=new Array();
    cityareaname[32]=new Array();
    if (selectP == '34') {
        a = 34;
        tempoption = new Option('澳门','34',false,true);
    } else {
        tempoption=new Option('澳门','34');
    }
    eval('document.'+formname+'.'+preP+'.options[34]=tempoption;');
    cityareacode[33]=new Array();
    cityareaname[33]=new Array();
    if (selectP=='35') {
        a = 35;
        tempoption = new Option('台湾','35',false,true);
    } else {
        tempoption=new Option('台湾','35');
    }
    eval('document.'+formname+'.'+preP+'.options[35]=tempoption;');
    cityareacode[34]=new Array();
    cityareaname[34]=new Array();
    eval('document.'+formname+'.'+preP+'.options[a].selected=true;');
    cityid=selectP;
    if (cityid!='0') {
        b = 0 ;
        for (i = 0; i < cityareaname[cityid-1].length; i++) {
            if (selectC==cityareacode[cityid-1][i]) {
                b = i+1;
                tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i],false,true);
            } else {
                tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i]);
            }
            eval('document.'+formname+'.'+preC+'.options[i+1]=tempoption;');
        }
        eval('document.'+formname+'.'+preC+'.options[b].selected=true;');
    }
}

function selectcityarea(preP,preC,formname) {
    cityid=eval('document.'+formname+'.'+preP+'.selectedIndex;');
    j = eval('document.'+formname+'.'+preC+'.length;');
    for (i=1;i<j;i++) {
        eval('document.'+formname+'.'+preC+'.options[j-i]=null;')
    }
    if (cityid!="0") {
        for (i=0;i<cityareaname[cityid-1].length;i++) {
            tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i]);
            eval('document.'+formname+'.'+preC+'.options[i+1]=tempoption;');
        }
    }
}
</script>

<form action="/procProvince" method="post or get" name="form1">
    <label>省份:</label>
    <select name="selectp" onchange="selectcityarea('selectp','selectc','form1');">
        <option value="0" selected="">不限
        </option>
    </select>

    <label>县/市:</label>
    <select name="selectc">
        <option value="0" selected="">不限
        </option>
    </select>

    <input type="submit" value="确定" style=“width: 100px” />
</form>

<script language="javascript">
first("selectp","selectc","form1",0,0);
</script>

B、说明、解释,使用技巧

i、如果不加改造,用法是这样的

此代码虽然可以正常工作。
比如将它放在shttpd服务器的web目录下,访问127.0.0.1:port/xx.html 时,可以成功看到全国省市级联下拉框,能够完美工作。
  点击确定按钮,能够向服务器发送两个值,把 method 设置为 get,这样可以在浏览器中看到发送的具体内容:selectp=03&selectc=0307

ii、默认用法的缺陷

1、采用独立文件,无法与其它功能集成在同一个界面显示
  如果硬要采用 <iframe> 将它们嵌套在一起,那么当向后台发送请示后,后台回复的数据,只会显示在原来<iframe>所在区域,千万显示混乱

2、此段代码,量虽然大,绝大部分是js代码。
  所以可以将其分割为 provinceSelect.js 和 provinceSelect.html 两个文件。
  html部分因为内容不多,采用 shttpd_printf 打印出来也是可以的。
  这样一来,在 shttpd C 源码中,就轻松包含了一个功能👍强大,而且完整的 html 代码。而 C 代码本身,还很小巧漂亮。

3、采用默认方法,向后台传送的是数字给编码 03为省,0307为市,具体表示什么需要在 C 中建立相应的数组,进行对比查询。
   这实际是最具风险的事情,因为数组可能位置错位,造成很大的麻烦。而且建立全国省市数组,也是不小的工作量。
   希望希望能够直接传输省市字符串到后台,后台收到后直接使用。如江苏连云港,后台的C代码不用对数字进行处理

iiii、解决办法

1、对于文件过大,不够灵活的问题,采用分割原文件为 proinceSelect.js 和 html 的方式解决

2、对于无法与其它控件在同一个页面显示问题,采用 shttpd_printf() 输出的方式来解决

3、对于后台不想接收数字,想接收字符串的问题
    可以在原来的<form>中,再增加一个<input type="hidden" /> 控件,一旦用户点击了确定按钮,首先从两个下拉框中取出当前的省市值,赋值给隐藏控件的value,然后再调用<form>的submit函数,将它内部的所有控件值传给后台。
    后台收到数据,直接跳过前面的两个数字,只提取隐藏控件中的值,即省市字符串。

综上所述,在shttpd中,需要添加的代码为

shttpd_printf(arg,"%s",
    "<form id=\"allData\" action=\"\" method=\"get\" name=\"form1\"> "
    "<fieldset><legend>省市</legend>"
    "<label>省</label>"
    "<select id=\"provinceSlect\" name=\"selectp\" onChange=\"selectcityarea('selectp','selectc','form1');\“ style=\"width:80px\" >"
    "   <option value=\"0\" selected>全国</option>"
    "</select>"

    "<label>市</label>"
    "<select id=\"citySelect\" name=\"selectc\" style=\"width:80px;\" >"
    "   <option value=\"0\" selected>全省</option>
    "</selected>"

    "<label>运营商</label>"
    "<select id=\"isp\" style=\"xxx\">"
    "   <option value=\"0\" selected>全部</option>"
    "....三大运营商...."
    "</selected>"

    //这行是辅助传数据的控件,是关键技术
    "<input type=\"hidden\" id=\"auxData\" value=\"\" />"

    //这行增加一个手工输入框,为防止下拉框中内容不全
    "<input type=\"text\" id=\"mannualInput\" name=\"manualInput\" placeholder=\"输入框提示请,请注意\" style=\"width:800px\" >"
    "<input type=\"submit\" onclick=\"confirmSelect()\" value=\"确定查询\" style=\"width:100px\" />"
    "</fieldset>"
    "</form>"
    )

4、为了将下拉框的值赋值给 <input>控件,需要如下代码
function confirmSelect() {
    var province=$("#provinceSelect option:selected");
    var cityText=$("#citySelect option:selected")
    var ISP=$("#ISP option:selected")
    //得到三个下拉框的值,将它们合并成一个字符串
    var auxData=province.text()+','+cityText.text()+','+ISP.text();
    //将合并后的值赋值给隐藏控件
    $('#auxData').val(auxData);
    //最后调用<form>的submit函数
    $("#allData").submit();
}

四、js 怎样根据控件ID,定位它的位置

1、方法一:js原生方法

var oDiv = document.getElementById('divID');
alert(oDiv.getBoundingClientRect().left)
alert(oDiv.getBoundingClientRect().top)

2、方法二,为什么要这么费事

function getElementPos(elementId) {
    var ua = navigator.userAgent.toLowerCase();
    var isOpera = (ua.indexOf('opera') != -1);
    var isIE = (ua.indexOf('msie') != -1 && !isOpera); // not opera spoof
    var el = document.getElementById(elementId);
    if (el.parentNode === null ||
        el.style.display == 'none') {
        return false;
    }
    var parent = null;
    var pos = [];
    var box;
    if (el.getBoundingClientRect) //IE
    {
        box = el.getBoundingClientRect();
        var scrollTop = Math.max(document.documentElement.scrollTop, document.body.scrollTop);
        var scrollLeft = Math.max(document.documentElement.scrollLeft, document.body.scrollLeft);
        return {
            x: box.left + scrollLeft,
            y: box.top + scrollTop
        };
    }
    else if (document.getBoxObjectFor) //gecko
    {
        box = document.getBoxObjectFor(el);
        var borderLeft = (el.style.borderLeftWidth) ? parseInt(el.style.borderLeftWidth) : 0;
        var borderTop = (el.style.borderTopWidth) ? parseInt(el.style.borderTopWidth) : 0;
        pos = [box.x - borderLeft, box.y - borderTop];
    }
    else // safari & opera
    {
        pos = [el.offsetLeft, el.offsetTop];
        parent = el.offsetParent;
        if (parent != el) {
            while (parent) {
                pos[0] += parent.offsetLeft;
                pos[1] += parent.offsetTop;
                parent = parent.offsetParent;
            }
        }
        if (ua.indexOf('opera') != -1 ||
            (ua.indexOf('safari') != -1 &&
             el.style.position == 'absolute')) {
            pos[0] -= document.body.offsetLeft;
            pos[1] -= document.body.offsetTop;
        }
    }
    if (el.parentNode) {
        parent = el.parentNode;
    } else {
        parent = null;
    }
    while (parent &&
           parent.tagName != 'BODY' && parent.tagName != 'HTML') { // account for any scrolled ancestors
        pos[0] -= parent.scrollLeft;
        pos[1] -= parent.scrollTop;
        if (parent.parentNode) {
            parent = parent.parentNode;
        } else {
            parent = null;
        }
    }
    return {
        x: pos[0],
        y: pos[1]
    };
}

3、一个应用,将鼠标放到表格某项时,弹出相关数据,要求内容跟随鼠标

根据上述函数,以控件ID获取其左上角坐标,然后在新位置弹出表格即可
实验代码如下,建立一个table,为某些单元格分配ID
再建立两个默认隐藏的table,当鼠标移到相关位置时,将其显示,但是需要更改其位置信息

<html>
    <body>
        <p>鼠标移动到该段落</p>
        <table>
            <tr><th>name</th><th>detail</th></tr>
            <tr><td>zhou</td><td id="zhouMore">more</td></tr>
            <tr><td>wang</td><td id="wangMore">more</td></tr>
        </table>

        <table id="zhouDescript" width="400px" border="3px"
               cellspacing="0px" style="visibility:hidden">
            <tr><th>province</th><th>city</th><th>country</th></tr>
            <tr><td>jiangsu</td><td>lianyungang</td><td>china</td></tr>
        </table>

        <table id="wangDescript" width="400px" border="3px"
               cellspacing="0px" style="visibility:hidden">
            <tr><th>province</th><th>city</th><th>country</th></tr>
            <tr><td>sichuan</td><td>chendu</td><td>china</td></tr>
        </table>
    </body>
</html>

为了达到鼠标挪到表格时,将隐藏表格显示出来,需要加入如下 js 代码进行处理
这段代码采用jQuery写成

$(document).ready(function(){
    //$("p")表示对所有的<p>标签类型
    $("p").hover(  //这是一个基础代码,如果在函数开始加一名printf
        function() { //这是将鼠标挪到P上时发生的事件
            $("p").css("background-color", "yellow");
            //document.write("<h1>this is a heading!</h1>");
        },function(){//这是将鼠标挪走时,发生的事件
            $("p").css("background-color", "pink");
    })
    //$("#zhouMore")表示对ID值zhouDescript的对象进行操作
    $("#zhouMore").hover(
        function(){
            var basePos=getElementPos("zhouMore");
            //鼠标挪过来之后,将关键区域颜色标红
            $("#zhouMore").css("background-color", "pink");
            $("#zhouDescript").css("position","absolute");
            $("#zhouDescript").css(
            {
                "left":150 + "px",
                "top":basePos.y + "px",
                "color":"white",
                "background-color":"#98bf21",
                "font-family":"Arial",
                "font-size":"20px",
                "padding":"5px"
            });
            $("#zhouDescript").css("visibility","visible");
        },function(){
            $("#zhouMore").css("background-color":"white");
            $("#zhouDescript").css("visibility","hidden");
        }
    )
    $("#wangMore").hover(
        function(){
            var basePos=getElementPos("#wangMore");
            $("#wangMore").css("background-color":"pink");
            $("#wangDescript").css({
                "position":"absolute",
                "left":150 + "px",
                "top":basePos.y + "px",
                "color":"white",
                "background-color":"#98bf21",
                "font-family":"Arial",
                "font-size":"20px",
                "padding":"5px"
            })
            $("#wangDescript").css("visibility","visible");
        },function(){
            $("#wangMore").css("background-color","white");
            $("#wangMore").css("visibility":"hidden");
        });
});

4、感慨

当时想用这个功能的时候,引入一个bug。
折腾了一天,都没有查出来,最终只得放弃。
今日手工誊写,一眼看出故障所在。

五、js + html 实现简易考试系统(https://blog.csdn.net/asdfzjs/article/details/38386119)

1、第一种

<html>
<head>
<meta http-equiv="Content-Language" mrc="zh-cn">
<meta http-equiv="Content-Type" mrc="text/html; charset=gb2312">
<title>JavaScript在线考试系统</title>
</head>
<body>
<SCRIPT LANGUAGE="JavaScript">
<!-- 
function scorequiz(form) {  var list=0  if(form.Q1.value!=null  &&  form.Q1.value=="*") {list=list+10}  if(form.Q2.value!=null  &&  form.Q2.value=="*") {list=list+10}  if(form.Q3.value!=null  &&  form.Q3.value=="*") {list=list+10}  if(form.Q4.value!=null  &&  form.Q4.value=="*") {list=list+10}  if(form.Q5.value!=null  &&  form.Q5.value=="*") {list=list+10}  if(form.Q6.value!=null  &&  form.Q6.value=="*") {list=list+10}  if(form.Q7.value!=null  &&  form.Q7.value=="*") {list=list+10}  if(form.Q8.value!=null  &&  form.Q8.value=="*") {list=list+10}  if(form.Q9.value!=null  &&  form.Q9.value=="*") {list=list+10}  if(form.Q10.value!=null  &&  form.Q10.value=="*") {list=list+10}  //alert(list);  form.SCORE.value =eval(list)  if (form.SCORE.value<=80){
ok="加油呀,你这次不及格哦!"
alert(ok)}
}  
function clearquiz(form) {  var list=0  form.Q1.value="?"  form.Q2.value="?"  form.Q3.value="?"  form.Q4.value="?"  form.Q5.value="?"  form.Q6.value="?"  form.Q7.value="?"  form.Q8.value="?"  form.Q9.value="?"  form.Q10.value="?"  form.SCORE.value =eval(list)
}
function msg() {  alert("您的成绩将E-mail给相关人员。")  }
// -->
</SCRIPT>
<body>
<table width="75%" border="0" align="center">   <tr>     <td>        <form name="quiz1"   action ="mailto:www.baidu.com@163.com"  method="post" enctype="text/plain"   onLoad="clearquiz(this.form)" onSubmit="msg()">         您的姓名:            <input type="Text" name="Name" value="" class="pt9">         <hr>         1. Internet上使用的网络协议是:__________            <ol>           <input type="radio" name="Q1" value="*TCP/IP" onClick=Q1.value="*">           TCP/IP           <input type="radio" name="Q1" value="X.25" onClick=Q1.value="X.25">           X.25           <input type="radio" name="Q1" value="NetBEUI" onClick=Q1.value="NetBEUI">           NetBEUI         </ol>         2. 我们通过__________长距离连接两台计算机使它们通讯。            <ol>           <input type="radio" name="Q2" value="LAN" onClick=Q2.value="A">           LAN              <input type="radio" name="Q2" value="*WAN" onClick=Q2.value="*">           WAN              <input type="radio" name="Q2" value="WAIS" onClick=Q2.value="C">           WAIS         </ol>         3. HUB是指:__________            <ol>           <input type="radio" name="Q3" value="网关" onClick=Q3.value="网关">           网关              <input type="radio" name="Q3" value="网桥" onClick=Q3.value="网桥">           网桥              <input type="radio" name="Q3" value="路由器" onClick=Q3.value="路由器">           路由器              <input type="radio" name="Q3" value="*集线器" onClick=Q3.value="*">           集线器            </ol>         4. 56K MODEM的传输速度为:__________            <ol>           <input type="radio" name="Q4" value="56Kbytes" onClick=Q4.value="A">           每秒传输56K bytes的数据。               <input type="radio" name="Q4" value="*56kbps" onClick=Q4.value="*">           每秒传输56k bits的数据。             </ol>         5. Gateway是指:__________            <ol>           <input type="radio" name="Q5" value="*网关" onClick=Q5.value="*">           网关              <input type="radio" name="Q5" value="网桥" onClick=Q5.value="B">           网桥              <input type="radio" name="Q5" value="路由器" onClick=Q5.value="C">           路由器              <input type="radio" name="Q5" value="集线器" onClick=Q5.value="D">           集线器            </ol>         6. Http默认的端口是:__________            <ol>           <input type="radio" name="Q6" value="8080" onClick=Q6.value="A">           8080             <input type="radio" name="Q6" value="*80" onClick=Q6.value="*">           80             <input type="radio" name="Q6" value="25" onClick=Q6.value="25">           25           </ol>         7. JavaScript是一种类似于C++的语言,比较难掌握:__________            <ol>           <input type="radio" name="Q7" value="True" onClick=Q7.value="T">           True             <input type="radio" name="Q7" value="*False" onClick=Q7.value="*">           False           </ol>         8. JAVA是 __________ 公司的产品:            <ol>           <input type="radio" name="Q8" value="Microsoft" onClick=Q8.value="A">           Microsoft              <input type="radio" name="Q8" value="Novell" onClick=Q8.value="B">           Novell              <input type="radio" name="Q8" value="*SUN" onClick=Q8.value="*">           SUN            </ol>         9. CGI通过__________收集用户填写的表单信息:            <ol>           <input type="radio" name="Q9" value="Form" onClick=Q9.value="A">           Form              <input type="radio" name="Q9" value="*环境变量" onClick=Q9.value="*">           环境变量              <input type="radio" name="Q9" value="javascripts脚本" onClick=Q9.value="C">           javascripts脚本            </ol>         10. 服务器响应"404 error"的含义是: __________            <ol>           <input type="radio" name="Q10" value="*文件不存在" onClick=Q10.value="*">           文件不存在           <input type="radio" name="Q10" value="Server error" onClick=Q10.value="B">           服务器错误        <input type="radio" name="Q10" value="Client error" onClick=Q10.value="C">           浏览器错误            </ol>         <hr>         <input type="button" name="submit" value="开始评分" onClick=scorequiz(this.form) class="pt9">         <input type="reset" name="reset" value="重新测试" onClick=clearquiz(this.form) class="pt9">           <input type="submit" value="将成绩MAIL给管理员" onClick=scorequiz(this.form) name="submit" class="pt9">           你的考试成绩:            <input  name="SCORE" type="text" class="pt9">       </form>
</body>
</html>

2、第二种(全是单选题,从网站原文复制,只是减少了题目)

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>在线考试系统</title>
<style type="text/css">
*{padding:0;margin:0;}
body{
font-size:14px;
background-color:#F9FCFD;
}
.highlight{ background-color:#FCFFD7;}
.selected{background-color:#FFEBD7;}
.div_topic{
padding:10px;
border:#73AFD0 dashed;
border-width: 0 0 1px 0;
background-color:#F9FCFD;
}
.div_topic.odd{background-color: #E0EEF5;}
.div_topic h4{
font-size:16px;
color:#22536A;
display:block;
padding:3px;
}
.div_topic p{
display:block;
padding:3px;
}
.div_topic h4 span{
padding:0 0 0 20px;
color:#FF0000;
display:none;
}
#fixedLayer {
width:100%;
background-color: #A3CBE0;
border:1px solid #73AFD0;
position:fixed;
left:0px;
top:0px;
}
#answer_last {
width:150px;
padding:10px;
background-color:#FFCC00;
border:1px dashed #888313;
position:fixed;
right:0px;
top:42px;
display:none;
}
#fixedLayer div{
padding:10px;
}
#topic_num{
width:30px;
text-align:center;
}
#topic_right{
float:right;
}
#status{
color:#FF0000;
font-size:14;
font-weight:bold;}
/*打印时,背景为白色*/
@media print{
body{
font-size:12px;
background-color:#fff;
}
.div_topic{
padding:5px;
border:#000 dashed;
border-width: 0 0 1px 0;
background-color:#fff;
}
.div_topic h4{
font-size:14px;
color:#000;
}
.div_topic h4 span{ display:none}
#answer_last {
background-color:#eee;
border:1px dashed #333;
color:#000000;
display:block;
position: static;
width:auto;
height:auto;
}
}
</style>
<!--[if IE]>
<style type="text/css">
html {height:100%;overflow:hidden;}
body {height:100%;overflow:auto;}
#fixedLayer{position:absolute;}
#answer_last{position:absolute;}
</style>
<![endif]-->
<script>
// 烈火網 liehuo.net 欢迎复制,拒绝恶意采集 liehuo.net
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(J(){7(1e.19)L w=1e.19;L E=1e.19=J(a,b){K 1D E.2m.4Y(a,b)};7(1e.$)L D=1e.$;1e.$=E;L u=/^[^<]*(<(.|\\s)+>)[^>]*$|^#(\\w+)$/;L G=/^.[^:#\\[\\.]*$/;E.1i=E.2m={4Y:J(d,b){d=d||T;7(d.15){6[0]=d;6.M=1;K 6}N 7(1v d=="25"){L c=u.39(d);7(c&&(c[1]||!b)){7(c[1])d=E.5c([c[1]],b);N{L a=T.5N(c[3]);7(a)7(a.2s!=c[3])K E().2r(d);N{6[0]=a;6.M=1;K 6}N d=[]}}N K 1D E(b).2r(d)}N 7(E.1q(d))K 1D E(T)[E.1i.21?"21":"43"](d);K 6.6G(d.1n==1N&&d||(d.5j||d.M&&d!=1e&&!d.15&&d[0]!=10&&d[0].15)&&E.2H(d)||[d])},5j:"1.2.2",82:J(){K 6.M},M:0,22:J(a){K a==10?E.2H(6):6[a]},2E:J(b){L a=E(b);a.56=6;K a},6G:J(a){6.M=0;1N.2m.1h.1j(6,a);K 6},V:J(a,b){K E.V(6,a,b)},5E:J(b){L a=-1;6.V(J(i){7(6==b)a=i});K a},1K:J(c,a,b){L d=c;7(c.1n==4d)7(a==10)K 6.M&&E[b||"1K"](6[0],c)||10;N{d={};d[c]=a}K 6.V(J(i){P(c 1r d)E.1K(b?6.Y:6,c,E.1l(6,d[c],b,i,c))})},1m:J(b,a){7((b==\'29\'||b==\'1P\')&&2M(a)<0)a=10;K 6.1K(b,a,"2q")},1t:J(b){7(1v b!="4D"&&b!=W)K 6.4B().3t((6[0]&&6[0].2u||T).5v(b));L a="";E.V(b||6,J(){E.V(6.3p,J(){7(6.15!=8)a+=6.15!=1?6.6M:E.1i.1t([6])})});K a},5r:J(b){7(6[0])E(b,6[0].2u).5J().3n(6[0]).2a(J(){L a=6;2e(a.1B)a=a.1B;K a}).3t(6);K 6},8t:J(a){K 6.V(J(){E(6).6C().5r(a)})},8m:J(a){K 6.V(J(){E(6).5r(a)})},3t:J(){K 6.3P(1a,R,S,J(a){7(6.15==1)6.3k(a)})},6s:J(){K 6.3P(1a,R,R,J(a){7(6.15==1)6.3n(a,6.1B)})},6o:J(){K 6.3P(1a,S,S,J(a){6.1b.3n(a,6)})},5a:J(){K 6.3P(1a,S,R,J(a){6.1b.3n(a,6.2J)})},3h:J(){K 6.56||E([])},2r:J(b){L c=E.2a(6,J(a){K E.2r(b,a)});K 6.2E(/[^+>] [^+>]/.17(b)||b.1g("..")>-1?E.57(c):c)},5J:J(e){L f=6.2a(J(){7(E.14.1d&&!E.3W(6)){L a=6.6c(R),5u=T.2R("1u"),4T=T.2R("1u");5u.3k(a);4T.38=5u.38;K 4T.1B}N K 6.6c(R)});L d=f.2r("*").4R().V(J(){7(6[F]!=10)6[F]=W});7(e===R)6.2r("*").4R().V(J(i){7(6.15==3)K;L c=E.Q(6,"2N");P(L a 1r c)P(L b 1r c[a])E.16.1c(d[i],a,c[a][b],c[a][b].Q)});K f},1F:J(b){K 6.2E(E.1q(b)&&E.3x(6,J(a,i){K b.1O(a,i)})||E.3d(b,6))},4I:J(b){7(b.1n==4d)7(G.17(b))K 6.2E(E.3d(b,6,R));N b=E.3d(b,6);L a=b.M&&b[b.M-1]!==10&&!b.15;K 6.1F(J(){K a?E.35(6,b)<0:6!=b})},1c:J(a){K!a?6:6.2E(E.34(6.22(),a.1n==4d?E(a).22():a.M!=10&&(!a.12||E.12(a,"3i"))?a:[a]))},3K:J(a){K a?E.3d(a,6).M>0:S},7g:J(a){K 6.3K("."+a)},5P:J(b){7(b==10){7(6.M){L c=6[0];7(E.12(c,"2y")){L e=c.44,5L=[],11=c.11,30=c.U=="2y-30";7(e<0)K W;P(L i=30?e:0,2b=30?e+1:11.M;i<2b;i++){L d=11[i];7(d.2p){b=E.14.1d&&!d.9s.1C.9o?d.1t:d.1C;7(30)K b;5L.1h(b)}}K 5L}N K(6[0].1C||"").1p(/\\r/g,"")}K 10}K 6.V(J(){7(6.15!=1)K;7(b.1n==1N&&/5w|5y/.17(6.U))6.3o=(E.35(6.1C,b)>=0||E.35(6.37,b)>=0);N 7(E.12(6,"2y")){L a=b.1n==1N?b:[b];E("90",6).V(J(){6.2p=(E.35(6.1C,a)>=0||E.35(6.1t,a)>=0)});7(!a.M)6.44=-1}N 6.1C=b})},3q:J(a){K a==10?(6.M?6[0].38:W):6.4B().3t(a)},6P:J(a){K 6.5a(a).1Y()},6N:J(i){K 6.2V(i,i+1)},2V:J(){K 6.2E(1N.2m.2V.1j(6,1a))},2a:J(b){K 6.2E(E.2a(6,J(a,i){K b.1O(a,i,a)}))},4R:J(){K 6.1c(6.56)},3P:J(g,f,h,d){L e=6.M>1,3m;K 6.V(J(){7(!3m){3m=E.5c(g,6.2u);7(h)3m.8I()}L b=6;7(f&&E.12(6,"1V")&&E.12(3m[0],"4x"))b=6.3V("1S")[0]||6.3k(6.2u.2R("1S"));L c=E([]);E.V(3m,J(){L a=e?E(6).5J(R)[0]:6;7(E.12(a,"1o")){c=c.1c(a)}N{7(a.15==1)c=c.1c(E("1o",a).1Y());d.1O(b,a)}});c.V(6D)})}};E.2m.4Y.2m=E.2m;J 6D(i,a){7(a.3R)E.3Q({1f:a.3R,3l:S,1G:"1o"});N E.5l(a.1t||a.6A||a.38||"");7(a.1b)a.1b.2X(a)}E.1s=E.1i.1s=J(){L b=1a[0]||{},i=1,M=1a.M,5i=S,11;7(b.1n==8f){5i=b;b=1a[1]||{};i=2}7(1v b!="4D"&&1v b!="J")b={};7(M==1){b=6;i=0}P(;i<M;i++)7((11=1a[i])!=W)P(L a 1r 11){7(b===11[a])6z;7(5i&&11[a]&&1v 11[a]=="4D"&&b[a]&&!11[a].15)b[a]=E.1s(b[a],11[a]);N 7(11[a]!=10)b[a]=11[a]}K b};L F="19"+(1D 3O()).3N(),6y=0,5e={};L H=/z-?5E|89-?87|1y|6q|85-?1P/i;E.1s({81:J(a){1e.$=D;7(a)1e.19=w;K E},1q:J(a){K!!a&&1v a!="25"&&!a.12&&a.1n!=1N&&/J/i.17(a+"")},3W:J(a){K a.1I&&!a.1k||a.28&&a.2u&&!a.2u.1k},5l:J(a){a=E.3f(a);7(a){L b=T.3V("6k")[0]||T.1I,1o=T.2R("1o");1o.U="1t/4l";7(E.14.1d)1o.1t=a;N 1o.3k(T.5v(a));b.3k(1o);b.2X(1o)}},12:J(b,a){K b.12&&b.12.2F()==a.2F()},1Q:{},Q:J(c,d,b){c=c==1e?5e:c;L a=c[F];7(!a)a=c[F]=++6y;7(d&&!E.1Q[a])E.1Q[a]={};7(b!=10)E.1Q[a][d]=b;K d?E.1Q[a][d]:a},3H:J(c,b){c=c==1e?5e:c;L a=c[F];7(b){7(E.1Q[a]){2T E.1Q[a][b];b="";P(b 1r E.1Q[a])1T;7(!b)E.3H(c)}}N{1R{2T c[F]}1W(e){7(c.55)c.55(F)}2T E.1Q[a]}},V:J(c,a,b){7(b){7(c.M==10){P(L d 1r c)7(a.1j(c[d],b)===S)1T}N P(L i=0,M=c.M;i<M;i++)7(a.1j(c[i],b)===S)1T}N{7(c.M==10){P(L d 1r c)7(a.1O(c[d],d,c[d])===S)1T}N P(L i=0,M=c.M,1C=c[0];i<M&&a.1O(1C,i,1C)!==S;1C=c[++i]){}}K c},1l:J(b,a,c,i,d){7(E.1q(a))a=a.1O(b,i);K a&&a.1n==53&&c=="2q"&&!H.17(d)?a+"2P":a},1w:{1c:J(c,b){E.V((b||"").2d(/\\s+/),J(i,a){7(c.15==1&&!E.1w.3E(c.1w,a))c.1w+=(c.1w?" ":"")+a})},1Y:J(c,b){7(c.15==1)c.1w=b!=10?E.3x(c.1w.2d(/\\s+/),J(a){K!E.1w.3E(b,a)}).6g(" "):""},3E:J(b,a){K E.35(a,(b.1w||b).3D().2d(/\\s+/))>-1}},6e:J(b,c,a){L e={};P(L d 1r c){e[d]=b.Y[d];b.Y[d]=c[d]}a.1O(b);P(L d 1r c)b.Y[d]=e[d]},1m:J(d,e,c){7(e=="29"||e=="1P"){L b,3S={3C:"4Z",4X:"23",18:"3u"},3r=e=="29"?["7P","7M"]:["7L","7K"];J 4S(){b=e=="29"?d.7J:d.7I;L a=0,3a=0;E.V(3r,J(){a+=2M(E.2q(d,"7H"+6,R))||0;3a+=2M(E.2q(d,"3a"+6+"62",R))||0});b-=1Z.7E(a+3a)}7(E(d).3K(":4b"))4S();N E.6e(d,3S,4S);K 1Z.2b(0,b)}K E.2q(d,e,c)},2q:J(e,k,j){L d;J 3y(b){7(!E.14.26)K S;L a=T.4a.4L(b,W);K!a||a.4K("3y")==""}7(k=="1y"&&E.14.1d){d=E.1K(e.Y,"1y");K d==""?"1":d}7(E.14.2B&&k=="18"){L c=e.Y.18;e.Y.18="3u";e.Y.18=c}7(k.1E(/4c/i))k=y;7(!j&&e.Y&&e.Y[k])d=e.Y[k];N 7(T.4a&&T.4a.4L){7(k.1E(/4c/i))k="4c";k=k.1p(/([A-Z])/g,"-$1").2w();L h=T.4a.4L(e,W);7(h&&!3y(e))d=h.4K(k);N{L f=[],2L=[];P(L a=e;a&&3y(a);a=a.1b)2L.4U(a);P(L i=0;i<2L.M;i++)7(3y(2L[i])){f[i]=2L[i].Y.18;2L[i].Y.18="3u"}d=k=="18"&&f[2L.M-1]!=W?"2D":(h&&h.4K(k))||"";P(L i=0;i<f.M;i++)7(f[i]!=W)2L[i].Y.18=f[i]}7(k=="1y"&&d=="")d="1"}N 7(e.4j){L g=k.1p(/\\-(\\w)/g,J(a,b){K b.2F()});d=e.4j[k]||e.4j[g];7(!/^\\d+(2P)?$/i.17(d)&&/^\\d/.17(d)){L l=e.Y.2c,3A=e.3A.2c;e.3A.2c=e.4j.2c;e.Y.2c=d||0;d=e.Y.7l+"2P";e.Y.2c=l;e.3A.2c=3A}}K d},5c:J(l,h){L k=[];h=h||T;7(1v h.2R==\'10\')h=h.2u||h[0]&&h[0].2u||T;E.V(l,J(i,d){7(!d)K;7(d.1n==53)d=d.3D();7(1v d=="25"){d=d.1p(/(<(\\w+)[^>]*?)\\/>/g,J(b,a,c){K c.1E(/^(7k|7h|5Q|7f|48|5O|a3|3v|9Y|9W|9T)$/i)?b:a+"></"+c+">"});L f=E.3f(d).2w(),1u=h.2R("1u");L e=!f.1g("<9R")&&[1,"<2y 78=\'78\'>","</2y>"]||!f.1g("<9O")&&[1,"<77>","</77>"]||f.1E(/^<(9K|1S|9I|9F|9A)/)&&[1,"<1V>","</1V>"]||!f.1g("<4x")&&[2,"<1V><1S>","</1S></1V>"]||(!f.1g("<9y")||!f.1g("<9v"))&&[3,"<1V><1S><4x>","</4x></1S></1V>"]||!f.1g("<5Q")&&[2,"<1V><1S></1S><76>","</76></1V>"]||E.14.1d&&[1,"1u<1u>","</1u>"]||[0,"",""];1u.38=e[1]+d+e[2];2e(e[0]--)1u=1u.5D;7(E.14.1d){L g=!f.1g("<1V")&&f.1g("<1S")<0?1u.1B&&1u.1B.3p:e[1]=="<1V>"&&f.1g("<1S")<0?1u.3p:[];P(L j=g.M-1;j>=0;--j)7(E.12(g[j],"1S")&&!g[j].3p.M)g[j].1b.2X(g[j]);7(/^\\s/.17(d))1u.3n(h.5v(d.1E(/^\\s*/)[0]),1u.1B)}d=E.2H(1u.3p)}7(d.M===0&&(!E.12(d,"3i")&&!E.12(d,"2y")))K;7(d[0]==10||E.12(d,"3i")||d.11)k.1h(d);N k=E.34(k,d)});K k},1K:J(d,e,c){7(!d||d.15==3||d.15==8)K 10;L f=E.3W(d)?{}:E.3S;7(e=="2p"&&E.14.26)d.1b.44;7(f[e]){7(c!=10)d[f[e]]=c;K d[f[e]]}N 7(E.14.1d&&e=="Y")K E.1K(d.Y,"9r",c);N 7(c==10&&E.14.1d&&E.12(d,"3i")&&(e=="9q"||e=="9p"))K d.9n(e).6M;N 7(d.28){7(c!=10){7(e=="U"&&E.12(d,"48")&&d.1b)6Z"U 9i 9g\'t 9b 9a";d.99(e,""+c)}7(E.14.1d&&/6T|3R/.17(e)&&!E.3W(d))K d.4z(e,2);K d.4z(e)}N{7(e=="1y"&&E.14.1d){7(c!=10){d.6q=1;d.1F=(d.1F||"").1p(/6W\\([^)]*\\)/,"")+(2M(c).3D()=="93"?"":"6W(1y="+c*6S+")")}K d.1F&&d.1F.1g("1y=")>=0?(2M(d.1F.1E(/1y=([^)]*)/)[1])/6S).3D():""}e=e.1p(/-([a-z])/92,J(a,b){K b.2F()});7(c!=10)d[e]=c;K d[e]}},3f:J(a){K(a||"").1p(/^\\s+|\\s+$/g,"")},2H:J(b){L a=[];7(1v b!="91")P(L i=0,M=b.M;i<M;i++)a.1h(b[i]);N a=b.2V(0);K a},35:J(b,a){P(L i=0,M=a.M;i<M;i++)7(a[i]==b)K i;K-1},34:J(a,b){7(E.14.1d){P(L i=0;b[i];i++)7(b[i].15!=8)a.1h(b[i])}N P(L i=0;b[i];i++)a.1h(b[i]);K a},57:J(a){L c=[],2j={};1R{P(L i=0,M=a.M;i<M;i++){L b=E.Q(a[i]);7(!2j[b]){2j[b]=R;c.1h(a[i])}}}1W(e){c=a}K c},3x:J(c,a,d){7(1v a=="25")a=4A("S||J(a,i){K "+a+"}");L b=[];P(L i=0,M=c.M;i<M;i++)7(!d&&a(c[i],i)||d&&!a(c[i],i))b.1h(c[i]);K b},2a:J(d,a){L c=[];P(L i=0,M=d.M;i<M;i++){L b=a(d[i],i);7(b!==W&&b!=10){7(b.1n!=1N)b=[b];c=c.6Q(b)}}K c}});L v=8X.8V.2w();E.14={5n:(v.1E(/.+(?:8R|8Q|8P|8O)[\\/: ]([\\d.]+)/)||[])[1],26:/6L/.17(v),2B:/2B/.17(v),1d:/1d/.17(v)&&!/2B/.17(v),3X:/3X/.17(v)&&!/(8M|6L)/.17(v)};L y=E.14.1d?"6K":"6J";E.1s({8J:!E.14.1d||T.6I=="6H",3S:{"P":"8G","8E":"1w","4c":y,6J:y,6K:y,38:"38",1w:"1w",1C:"1C",2W:"2W",3o:"3o",8C:"8B",2p:"2p",8A:"8z",44:"44",6F:"6F",28:"28",12:"12"}});E.V({6E:"O.1b",8y:"19.4w(O,\'1b\')",8x:"19.31(O,2,\'2J\')",8w:"19.31(O,2,\'4v\')",8v:"19.4w(O,\'2J\')",8u:"19.4w(O,\'4v\')",8s:"19.5m(O.1b.1B,O)",8r:"19.5m(O.1B)",6C:"19.12(O,\'8q\')?O.8p||O.8o.T:19.2H(O.3p)"},J(c,d){d=4A("S||J(O){K "+d+"}");E.1i[c]=J(b){L a=E.2a(6,d);7(b&&1v b=="25")a=E.3d(b,a);K 6.2E(E.57(a))}});E.V({6B:"3t",8n:"6s",3n:"6o",8l:"5a",8k:"6P"},J(c,b){E.1i[c]=J(){L a=1a;K 6.V(J(){P(L i=0,M=a.M;i<M;i++)E(a[i])[b](6)})}});E.V({8j:J(a){E.1K(6,a,"");7(6.15==1)6.55(a)},8i:J(a){E.1w.1c(6,a)},8h:J(a){E.1w.1Y(6,a)},8g:J(a){E.1w[E.1w.3E(6,a)?"1Y":"1c"](6,a)},1Y:J(a){7(!a||E.1F(a,[6]).r.M){E("*",6).1c(6).V(J(){E.16.1Y(6);E.3H(6)});7(6.1b)6.1b.2X(6)}},4B:J(){E(">*",6).1Y();2e(6.1B)6.2X(6.1B)}},J(a,b){E.1i[a]=J(){K 6.V(b,1a)}});E.V(["8e","62"],J(i,c){L b=c.2w();E.1i[b]=J(a){K 6[0]==1e?E.14.2B&&T.1k["5h"+c]||E.14.26&&1e["8d"+c]||T.6I=="6H"&&T.1I["5h"+c]||T.1k["5h"+c]:6[0]==T?1Z.2b(1Z.2b(T.1k["5g"+c],T.1I["5g"+c]),1Z.2b(T.1k["5f"+c],T.1I["5f"+c])):a==10?(6.M?E.1m(6[0],b):W):6.1m(b,a.1n==4d?a:a+"2P")}});L C=E.14.26&&4t(E.14.5n)<8c?"(?:[\\\\w*4s-]|\\\\\\\\.)":"(?:[\\\\w\\8b-\\8a*4s-]|\\\\\\\\.)",6w=1D 4r("^>\\\\s*("+C+"+)"),6v=1D 4r("^("+C+"+)(#)("+C+"+)"),6u=1D 4r("^([#.]?)("+C+"*)");E.1s({5d:{"":"m[2]==\'*\'||19.12(a,m[2])","#":"a.4z(\'2s\')==m[2]",":":{88:"i<m[3]-0",86:"i>m[3]-0",31:"m[3]-0==i",6N:"m[3]-0==i",3j:"i==0",3M:"i==r.M-1",6r:"i%2==0",6p:"i%2","3j-4m":"a.1b.3V(\'*\')[0]==a","3M-4m":"19.31(a.1b.5D,1,\'4v\')==a","84-4m":"!19.31(a.1b.5D,2,\'4v\')",6E:"a.1B",4B:"!a.1B",83:"(a.6A||a.80||19(a).1t()||\'\').1g(m[3])>=0",4b:\'"23"!=a.U&&19.1m(a,"18")!="2D"&&19.1m(a,"4X")!="23"\',23:\'"23"==a.U||19.1m(a,"18")=="2D"||19.1m(a,"4X")=="23"\',7Y:"!a.2W",2W:"a.2W",3o:"a.3o",2p:"a.2p||19.1K(a,\'2p\')",1t:"\'1t\'==a.U",5w:"\'5w\'==a.U",5y:"\'5y\'==a.U",5b:"\'5b\'==a.U",3J:"\'3J\'==a.U",59:"\'59\'==a.U",6n:"\'6n\'==a.U",6m:"\'6m\'==a.U",2G:\'"2G"==a.U||19.12(a,"2G")\',48:"/48|2y|6l|2G/i.17(a.12)",3E:"19.2r(m[3],a).M",7X:"/h\\\\d/i.17(a.12)",7W:"19.3x(19.3I,J(1i){K a==1i.O;}).M"}},6j:[/^(\\[) *@?([\\w-]+) *([!*$^~=]*) *(\'?"?)(.*?)\\4 *\\]/,/^(:)([\\w-]+)\\("?\'?(.*?(\\(.*?\\))?[^(]*?)"?\'?\\)/,1D 4r("^([:.#]*)("+C+"+)")],3d:J(a,c,b){L d,2o=[];2e(a&&a!=d){d=a;L f=E.1F(a,c,b);a=f.t.1p(/^\\s*,\\s*/,"");2o=b?c=f.r:E.34(2o,f.r)}K 2o},2r:J(t,p){7(1v t!="25")K[t];7(p&&p.15!=1&&p.15!=9)K[];p=p||T;L d=[p],2j=[],3M,12;2e(t&&3M!=t){L r=[];3M=t;t=E.3f(t);L o=S;L g=6w;L m=g.39(t);7(m){12=m[1].2F();P(L i=0;d[i];i++)P(L c=d[i].1B;c;c=c.2J)7(c.15==1&&(12=="*"||c.12.2F()==12))r.1h(c);d=r;t=t.1p(g,"");7(t.1g(" ")==0)6z;o=R}N{g=/^([>+~])\\s*(\\w*)/i;7((m=g.39(t))!=W){r=[];L l={};12=m[2].2F();m=m[1];P(L j=0,3g=d.M;j<3g;j++){L n=m=="~"||m=="+"?d[j].2J:d[j].1B;P(;n;n=n.2J)7(n.15==1){L h=E.Q(n);7(m=="~"&&l[h])1T;7(!12||n.12.2F()==12){7(m=="~")l[h]=R;r.1h(n)}7(m=="+")1T}}d=r;t=E.3f(t.1p(g,""));o=R}}7(t&&!o){7(!t.1g(",")){7(p==d[0])d.4k();2j=E.34(2j,d);r=d=[p];t=" "+t.6i(1,t.M)}N{L k=6v;L m=k.39(t);7(m){m=[0,m[2],m[3],m[1]]}N{k=6u;m=k.39(t)}m[2]=m[2].1p(/\\\\/g,"");L f=d[d.M-1];7(m[1]=="#"&&f&&f.5N&&!E.3W(f)){L q=f.5N(m[2]);7((E.14.1d||E.14.2B)&&q&&1v q.2s=="25"&&q.2s!=m[2])q=E(\'[@2s="\'+m[2]+\'"]\',f)[0];d=r=q&&(!m[3]||E.12(q,m[3]))?[q]:[]}N{P(L i=0;d[i];i++){L a=m[1]=="#"&&m[3]?m[3]:m[1]!=""||m[0]==""?"*":m[2];7(a=="*"&&d[i].12.2w()=="4D")a="3v";r=E.34(r,d[i].3V(a))}7(m[1]==".")r=E.58(r,m[2]);7(m[1]=="#"){L e=[];P(L i=0;r[i];i++)7(r[i].4z("2s")==m[2]){e=[r[i]];1T}r=e}d=r}t=t.1p(k,"")}}7(t){L b=E.1F(t,r);d=r=b.r;t=E.3f(b.t)}}7(t)d=[];7(d&&p==d[0])d.4k();2j=E.34(2j,d);K 2j},58:J(r,m,a){m=" "+m+" ";L c=[];P(L i=0;r[i];i++){L b=(" "+r[i].1w+" ").1g(m)>=0;7(!a&&b||a&&!b)c.1h(r[i])}K c},1F:J(t,r,h){L d;2e(t&&t!=d){d=t;L p=E.6j,m;P(L i=0;p[i];i++){m=p[i].39(t);7(m){t=t.7V(m[0].M);m[2]=m[2].1p(/\\\\/g,"");1T}}7(!m)1T;7(m[1]==":"&&m[2]=="4I")r=G.17(m[3])?E.1F(m[3],r,R).r:E(r).4I(m[3]);N 7(m[1]==".")r=E.58(r,m[2],h);N 7(m[1]=="["){L g=[],U=m[3];P(L i=0,3g=r.M;i<3g;i++){L a=r[i],z=a[E.3S[m[2]]||m[2]];7(z==W||/6T|3R|2p/.17(m[2]))z=E.1K(a,m[2])||\'\';7((U==""&&!!z||U=="="&&z==m[5]||U=="!="&&z!=m[5]||U=="^="&&z&&!z.1g(m[5])||U=="$="&&z.6i(z.M-m[5].M)==m[5]||(U=="*="||U=="~=")&&z.1g(m[5])>=0)^h)g.1h(a)}r=g}N 7(m[1]==":"&&m[2]=="31-4m"){L e={},g=[],17=/(-?)(\\d*)n((?:\\+|-)?\\d*)/.39(m[3]=="6r"&&"2n"||m[3]=="6p"&&"2n+1"||!/\\D/.17(m[3])&&"7U+"+m[3]||m[3]),3j=(17[1]+(17[2]||1))-0,d=17[3]-0;P(L i=0,3g=r.M;i<3g;i++){L j=r[i],1b=j.1b,2s=E.Q(1b);7(!e[2s]){L c=1;P(L n=1b.1B;n;n=n.2J)7(n.15==1)n.4p=c++;e[2s]=R}L b=S;7(3j==0){7(j.4p==d)b=R}N 7((j.4p-d)%3j==0&&(j.4p-d)/3j>=0)b=R;7(b^h)g.1h(j)}r=g}N{L f=E.5d[m[1]];7(1v f!="25")f=E.5d[m[1]][m[2]];f=4A("S||J(a,i){K "+f+"}");r=E.3x(r,f,h)}}K{r:r,t:t}},4w:J(b,c){L d=[];L a=b[c];2e(a&&a!=T){7(a.15==1)d.1h(a);a=a[c]}K d},31:J(a,e,c,b){e=e||1;L d=0;P(;a;a=a[c])7(a.15==1&&++d==e)1T;K a},5m:J(n,a){L r=[];P(;n;n=n.2J){7(n.15==1&&(!a||n!=a))r.1h(n)}K r}});E.16={1c:J(f,i,g,e){7(f.15==3||f.15==8)K;7(E.14.1d&&f.54!=10)f=1e;7(!g.2A)g.2A=6.2A++;7(e!=10){L h=g;g=J(){K h.1j(6,1a)};g.Q=e;g.2A=h.2A}L j=E.Q(f,"2N")||E.Q(f,"2N",{}),1x=E.Q(f,"1x")||E.Q(f,"1x",J(){L a;7(1v E=="10"||E.16.52)K a;a=E.16.1x.1j(1a.3G.O,1a);K a});1x.O=f;E.V(i.2d(/\\s+/),J(c,b){L a=b.2d(".");b=a[0];g.U=a[1];L d=j[b];7(!d){d=j[b]={};7(!E.16.2l[b]||E.16.2l[b].4i.1O(f)===S){7(f.3F)f.3F(b,1x,S);N 7(f.6h)f.6h("4h"+b,1x)}}d[g.2A]=g;E.16.2g[b]=R});f=W},2A:1,2g:{},1Y:J(e,h,f){7(e.15==3||e.15==8)K;L i=E.Q(e,"2N"),2f,5E;7(i){7(h==10)P(L g 1r i)6.1Y(e,g);N{7(h.U){f=h.2k;h=h.U}E.V(h.2d(/\\s+/),J(b,a){L c=a.2d(".");a=c[0];7(i[a]){7(f)2T i[a][f.2A];N P(f 1r i[a])7(!c[1]||i[a][f].U==c[1])2T i[a][f];P(2f 1r i[a])1T;7(!2f){7(!E.16.2l[a]||E.16.2l[a].4g.1O(e)===S){7(e.6f)e.6f(a,E.Q(e,"1x"),S);N 7(e.6d)e.6d("4h"+a,E.Q(e,"1x"))}2f=W;2T i[a]}}})}P(2f 1r i)1T;7(!2f){L d=E.Q(e,"1x");7(d)d.O=W;E.3H(e,"2N");E.3H(e,"1x")}}},1U:J(f,b,c,d,g){b=E.2H(b||[]);7(!c){7(6.2g[f])E("*").1c([1e,T]).1U(f,b)}N{7(c.15==3||c.15==8)K 10;L a,2f,1i=E.1q(c[f]||W),16=!b[0]||!b[0].32;7(16)b.4U(6.51({U:f,2K:c}));b[0].U=f;7(E.1q(E.Q(c,"1x")))a=E.Q(c,"1x").1j(c,b);7(!1i&&c["4h"+f]&&c["4h"+f].1j(c,b)===S)a=S;7(16)b.4k();7(g&&E.1q(g)){2f=g.1j(c,a==W?b:b.6Q(a));7(2f!==10)a=2f}7(1i&&d!==S&&a!==S&&!(E.12(c,\'a\')&&f=="50")){6.52=R;1R{c[f]()}1W(e){}}6.52=S}K a},1x:J(c){L a;c=E.16.51(c||1e.16||{});L b=c.U.2d(".");c.U=b[0];L f=E.Q(6,"2N")&&E.Q(6,"2N")[c.U],3B=1N.2m.2V.1O(1a,1);3B.4U(c);P(L j 1r f){L d=f[j];3B[0].2k=d;3B[0].Q=d.Q;7(!b[1]||d.U==b[1]){L e=d.1j(6,3B);7(a!==S)a=e;7(e===S){c.32();c.41()}}}7(E.14.1d)c.2K=c.32=c.41=c.2k=c.Q=W;K a},51:J(c){L a=c;c=E.1s({},a);c.32=J(){7(a.32)a.32();a.7T=S};c.41=J(){7(a.41)a.41();a.7S=R};7(!c.2K)c.2K=c.7R||T;7(c.2K.15==3)c.2K=a.2K.1b;7(!c.4W&&c.4V)c.4W=c.4V==c.2K?c.7Q:c.4V;7(c.6b==W&&c.6a!=W){L b=T.1I,1k=T.1k;c.6b=c.6a+(b&&b.2i||1k&&1k.2i||0)-(b.68||0);c.7O=c.7N+(b&&b.2x||1k&&1k.2x||0)-(b.67||0)}7(!c.3r&&((c.4f||c.4f===0)?c.4f:c.66))c.3r=c.4f||c.66;7(!c.65&&c.64)c.65=c.64;7(!c.3r&&c.2G)c.3r=(c.2G&1?1:(c.2G&2?3:(c.2G&4?2:0)));K c},2l:{21:{4i:J(){5A();K},4g:J(){K}},47:{4i:J(){7(E.14.1d)K S;E(6).2z("4Q",E.16.2l.47.2k);K R},4g:J(){7(E.14.1d)K S;E(6).42("4Q",E.16.2l.47.2k);K R},2k:J(a){7(I(a,6))K R;1a[0].U="47";K E.16.1x.1j(6,1a)}},46:{4i:J(){7(E.14.1d)K S;E(6).2z("4P",E.16.2l.46.2k);K R},4g:J(){7(E.14.1d)K S;E(6).42("4P",E.16.2l.46.2k);K R},2k:J(a){7(I(a,6))K R;1a[0].U="46";K E.16.1x.1j(6,1a)}}}};E.1i.1s({2z:J(c,a,b){K c=="4O"?6.30(c,a,b):6.V(J(){E.16.1c(6,c,b||a,b&&a)})},30:J(d,b,c){K 6.V(J(){E.16.1c(6,d,J(a){E(6).42(a);K(c||b).1j(6,1a)},c&&b)})},42:J(a,b){K 6.V(J(){E.16.1Y(6,a,b)})},1U:J(c,a,b){K 6.V(J(){E.16.1U(c,a,6,R,b)})},63:J(c,a,b){7(6[0])K E.16.1U(c,a,6[0],S,b);K 10},2h:J(){L b=1a;K 6.50(J(a){6.4N=0==6.4N?1:0;a.32();K b[6.4N].1j(6,1a)||S})},7F:J(a,b){K 6.2z(\'47\',a).2z(\'46\',b)},21:J(a){5A();7(E.2Q)a.1O(T,E);N E.3w.1h(J(){K a.1O(6,E)});K 6}});E.1s({2Q:S,3w:[],21:J(){7(!E.2Q){E.2Q=R;7(E.3w){E.V(E.3w,J(){6.1j(T)});E.3w=W}E(T).63("21")}}});L x=S;J 5A(){7(x)K;x=R;7(T.3F&&!E.14.2B)T.3F("61",E.21,S);7(E.14.1d&&1e==3b)(J(){7(E.2Q)K;1R{T.1I.7D("2c")}1W(3e){3z(1a.3G,0);K}E.21()})();7(E.14.2B)T.3F("61",J(){7(E.2Q)K;P(L i=0;i<T.4M.M;i++)7(T.4M[i].2W){3z(1a.3G,0);K}E.21()},S);7(E.14.26){L a;(J(){7(E.2Q)K;7(T.3c!="60"&&T.3c!="1z"){3z(1a.3G,0);K}7(a===10)a=E("Y, 5O[7B=7A]").M;7(T.4M.M!=a){3z(1a.3G,0);K}E.21()})()}E.16.1c(1e,"43",E.21)}E.V(("7z,7y,43,7x,5g,4O,50,7w,"+"7v,7u,7C,4Q,4P,7t,2y,"+"59,7s,7r,7G,3e").2d(","),J(i,b){E.1i[b]=J(a){K a?6.2z(b,a):6.1U(b)}});L I=J(a,c){L b=a.4W;2e(b&&b!=c)1R{b=b.1b}1W(3e){b=c}K b==c};E(1e).2z("4O",J(){E("*").1c(T).42()});E.1i.1s({43:J(g,d,c){7(E.1q(g))K 6.2z("43",g);L e=g.1g(" ");7(e>=0){L i=g.2V(e,g.M);g=g.2V(0,e)}c=c||J(){};L f="4J";7(d)7(E.1q(d)){c=d;d=W}N{d=E.3v(d);f="5Z"}L h=6;E.3Q({1f:g,U:f,1G:"3q",Q:d,1z:J(a,b){7(b=="1X"||b=="5Y")h.3q(i?E("<1u/>").3t(a.4e.1p(/<1o(.|\\s)*?\\/1o>/g,"")).2r(i):a.4e);h.V(c,[a.4e,b,a])}});K 6},7q:J(){K E.3v(6.5X())},5X:J(){K 6.2a(J(){K E.12(6,"3i")?E.2H(6.7p):6}).1F(J(){K 6.37&&!6.2W&&(6.3o||/2y|6l/i.17(6.12)||/1t|23|3J/i.17(6.U))}).2a(J(i,c){L b=E(6).5P();K b==W?W:b.1n==1N?E.2a(b,J(a,i){K{37:c.37,1C:a}}):{37:c.37,1C:b}}).22()}});E.V("5W,5V,5U,69,5T,5S".2d(","),J(i,o){E.1i[o]=J(f){K 6.2z(o,f)}});L B=(1D 3O).3N();E.1s({22:J(d,b,a,c){7(E.1q(b)){a=b;b=W}K E.3Q({U:"4J",1f:d,Q:b,1X:a,1G:c})},7o:J(b,a){K E.22(b,W,a,"1o")},7n:J(c,b,a){K E.22(c,b,a,"2O")},7m:J(d,b,a,c){7(E.1q(b)){a=b;b={}}K E.3Q({U:"5Z",1f:d,Q:b,1X:a,1G:c})},7Z:J(a){E.1s(E.4H,a)},4H:{2g:R,U:"4J",2U:0,5R:"49/x-7j-3i-7i",6x:R,3l:R,Q:W,6t:W,3J:W,4n:{3L:"49/3L, 1t/3L",3q:"1t/3q",1o:"1t/4l, 49/4l",2O:"49/2O, 1t/4l",1t:"1t/7e",4o:"*/*"}},4q:{},3Q:J(s){L f,2Y=/=\\?(&|$)/g,1A,Q;s=E.1s(R,s,E.1s(R,{},E.4H,s));7(s.Q&&s.6x&&1v s.Q!="25")s.Q=E.3v(s.Q);7(s.1G=="4u"){7(s.U.2w()=="22"){7(!s.1f.1E(2Y))s.1f+=(s.1f.1E(/\\?/)?"&":"?")+(s.4u||"7d")+"=?"}N 7(!s.Q||!s.Q.1E(2Y))s.Q=(s.Q?s.Q+"&":"")+(s.4u||"7d")+"=?";s.1G="2O"}7(s.1G=="2O"&&(s.Q&&s.Q.1E(2Y)||s.1f.1E(2Y))){f="4u"+B++;7(s.Q)s.Q=(s.Q+"").1p(2Y,"="+f+"$1");s.1f=s.1f.1p(2Y,"="+f+"$1");s.1G="1o";1e[f]=J(a){Q=a;1X();1z();1e[f]=10;1R{2T 1e[f]}1W(e){}7(h)h.2X(g)}}7(s.1G=="1o"&&s.1Q==W)s.1Q=S;7(s.1Q===S&&s.U.2w()=="22"){L i=(1D 3O()).3N();L j=s.1f.1p(/(\\?|&)4s=.*?(&|$)/,"$a2="+i+"$2");s.1f=j+((j==s.1f)?(s.1f.1E(/\\?/)?"&":"?")+"4s="+i:"")}7(s.Q&&s.U.2w()=="22"){s.1f+=(s.1f.1E(/\\?/)?"&":"?")+s.Q;s.Q=W}7(s.2g&&!E.5M++)E.16.1U("5W");7((!s.1f.1g("9Z")||!s.1f.1g("//"))&&(s.1G=="1o"||s.1G=="2O")&&s.U.2w()=="22"){L h=T.3V("6k")[0];L g=T.2R("1o");g.3R=s.1f;7(s.7c)g.9X=s.7c;7(!f){L l=S;g.9V=g.9U=J(){7(!l&&(!6.3c||6.3c=="60"||6.3c=="1z")){l=R;1X();1z();h.2X(g)}}}h.3k(g);K 10}L m=S;L k=1e.7a?1D 7a("9S.9Q"):1D 79();k.9P(s.U,s.1f,s.3l,s.6t,s.3J);1R{7(s.Q)k.4G("9N-9M",s.5R);7(s.5I)k.4G("9L-5H-9J",E.4q[s.1f]||"9H, 9G 9E 9B 5G:5G:5G 9z");k.4G("X-9x-9u","79");k.4G("9t",s.1G&&s.4n[s.1G]?s.4n[s.1G]+", */*":s.4n.4o)}1W(e){}7(s.75)s.75(k);7(s.2g)E.16.1U("5S",[k,s]);L c=J(a){7(!m&&k&&(k.3c==4||a=="2U")){m=R;7(d){74(d);d=W}1A=a=="2U"&&"2U"||!E.73(k)&&"3e"||s.5I&&E.72(k,s.1f)&&"5Y"||"1X";7(1A=="1X"){1R{Q=E.71(k,s.1G)}1W(e){1A="5C"}}7(1A=="1X"){L b;1R{b=k.5B("70-5H")}1W(e){}7(s.5I&&b)E.4q[s.1f]=b;7(!f)1X()}N E.5t(s,k,1A);1z();7(s.3l)k=W}};7(s.3l){L d=54(c,13);7(s.2U>0)3z(J(){7(k){k.9m();7(!m)c("2U")}},s.2U)}1R{k.9l(s.Q)}1W(e){E.5t(s,k,W,e)}7(!s.3l)c();J 1X(){7(s.1X)s.1X(Q,1A);7(s.2g)E.16.1U("5T",[k,s])}J 1z(){7(s.1z)s.1z(k,1A);7(s.2g)E.16.1U("5U",[k,s]);7(s.2g&&!--E.5M)E.16.1U("5V")}K k},5t:J(s,a,b,e){7(s.3e)s.3e(a,b,e);7(s.2g)E.16.1U("69",[a,s,e])},5M:0,73:J(r){1R{K!r.1A&&9k.9j=="5b:"||(r.1A>=6Y&&r.1A<9h)||r.1A==6X||r.1A==9e||E.14.26&&r.1A==10}1W(e){}K S},72:J(a,c){1R{L b=a.5B("70-5H");K a.1A==6X||b==E.4q[c]||E.14.26&&a.1A==10}1W(e){}K S},71:J(r,b){L c=r.5B("9d-U");L d=b=="3L"||!b&&c&&c.1g("3L")>=0;L a=d?r.9c:r.4e;7(d&&a.1I.28=="5C")6Z"5C";7(b=="1o")E.5l(a);7(b=="2O")a=4A("("+a+")");K a},3v:J(a){L s=[];7(a.1n==1N||a.5j)E.V(a,J(){s.1h(3s(6.37)+"="+3s(6.1C))});N P(L j 1r a)7(a[j]&&a[j].1n==1N)E.V(a[j],J(){s.1h(3s(j)+"="+3s(6))});N s.1h(3s(j)+"="+3s(a[j]));K s.6g("&").1p(/%20/g,"+")}});E.1i.1s({1J:J(c,b){K c?6.27({1P:"1J",29:"1J",1y:"1J"},c,b):6.1F(":23").V(J(){6.Y.18=6.5x||"";7(E.1m(6,"18")=="2D"){L a=E("<"+6.28+" />").6B("1k");6.Y.18=a.1m("18");7(6.Y.18=="2D")6.Y.18="3u";a.1Y()}}).3h()},1H:J(b,a){K b?6.27({1P:"1H",29:"1H",1y:"1H"},b,a):6.1F(":4b").V(J(){6.5x=6.5x||E.1m(6,"18");6.Y.18="2D"}).3h()},6U:E.1i.2h,2h:J(a,b){K E.1q(a)&&E.1q(b)?6.6U(a,b):a?6.27({1P:"2h",29:"2h",1y:"2h"},a,b):6.V(J(){E(6)[E(6).3K(":23")?"1J":"1H"]()})},98:J(b,a){K 6.27({1P:"1J"},b,a)},97:J(b,a){K 6.27({1P:"1H"},b,a)},96:J(b,a){K 6.27({1P:"2h"},b,a)},95:J(b,a){K 6.27({1y:"1J"},b,a)},94:J(b,a){K 6.27({1y:"1H"},b,a)},9f:J(c,a,b){K 6.27({1y:a},c,b)},27:J(l,k,j,h){L i=E.6V(k,j,h);K 6[i.2S===S?"V":"2S"](J(){7(6.15!=1)K S;L g=E.1s({},i);L f=E(6).3K(":23"),4y=6;P(L p 1r l){7(l[p]=="1H"&&f||l[p]=="1J"&&!f)K E.1q(g.1z)&&g.1z.1j(6);7(p=="1P"||p=="29"){g.18=E.1m(6,"18");g.36=6.Y.36}}7(g.36!=W)6.Y.36="23";g.40=E.1s({},l);E.V(l,J(c,a){L e=1D E.2v(4y,g,c);7(/2h|1J|1H/.17(a))e[a=="2h"?f?"1J":"1H":a](l);N{L b=a.3D().1E(/^([+-]=)?([\\d+-.]+)(.*)$/),24=e.2o(R)||0;7(b){L d=2M(b[2]),2C=b[3]||"2P";7(2C!="2P"){4y.Y[c]=(d||1)+2C;24=((d||1)/e.2o(R))*24;4y.Y[c]=24+2C}7(b[1])d=((b[1]=="-="?-1:1)*d)+24;e.3Z(24,d,2C)}N e.3Z(24,a,"")}});K R})},2S:J(a,b){7(E.1q(a)||(a&&a.1n==1N)){b=a;a="2v"}7(!a||(1v a=="25"&&!b))K A(6[0],a);K 6.V(J(){7(b.1n==1N)A(6,a,b);N{A(6,a).1h(b);7(A(6,a).M==1)b.1j(6)}})},8Z:J(b,c){L a=E.3I;7(b)6.2S([]);6.V(J(){P(L i=a.M-1;i>=0;i--)7(a[i].O==6){7(c)a[i](R);a.6R(i,1)}});7(!c)6.5z();K 6}});L A=J(b,c,a){7(!b)K 10;c=c||"2v";L q=E.Q(b,c+"2S");7(!q||a)q=E.Q(b,c+"2S",a?E.2H(a):[]);K q};E.1i.5z=J(a){a=a||"2v";K 6.V(J(){L q=A(6,a);q.4k();7(q.M)q[0].1j(6)})};E.1s({6V:J(b,a,c){L d=b&&b.1n==8Y?b:{1z:c||!c&&a||E.1q(b)&&b,2t:b,3Y:c&&a||a&&a.1n!=8W&&a};d.2t=(d.2t&&d.2t.1n==53?d.2t:{9w:8U,8T:6Y}[d.2t])||8S;d.5o=d.1z;d.1z=J(){7(d.2S!==S)E(6).5z();7(E.1q(d.5o))d.5o.1j(6)};K d},3Y:{6O:J(p,n,b,a){K b+a*p},5F:J(p,n,b,a){K((-1Z.9C(p*1Z.9D)/2)+0.5)*a+b}},3I:[],3T:W,2v:J(b,c,a){6.11=c;6.O=b;6.1l=a;7(!c.3U)c.3U={}}});E.2v.2m={4C:J(){7(6.11.33)6.11.33.1j(6.O,[6.2I,6]);(E.2v.33[6.1l]||E.2v.33.4o)(6);7(6.1l=="1P"||6.1l=="29")6.O.Y.18="3u"},2o:J(a){7(6.O[6.1l]!=W&&6.O.Y[6.1l]==W)K 6.O[6.1l];L r=2M(E.1m(6.O,6.1l,a));K r&&r>-8N?r:2M(E.2q(6.O,6.1l))||0},3Z:J(c,b,d){6.5s=(1D 3O()).3N();6.24=c;6.3h=b;6.2C=d||6.2C||"2P";6.2I=6.24;6.4E=6.4F=0;6.4C();L e=6;J t(a){K e.33(a)}t.O=6.O;E.3I.1h(t);7(E.3T==W){E.3T=54(J(){L a=E.3I;P(L i=0;i<a.M;i++)7(!a[i]())a.6R(i--,1);7(!a.M){74(E.3T);E.3T=W}},13)}},1J:J(){6.11.3U[6.1l]=E.1K(6.O.Y,6.1l);6.11.1J=R;6.3Z(0,6.2o());7(6.1l=="29"||6.1l=="1P")6.O.Y[6.1l]="8L";E(6.O).1J()},1H:J(){6.11.3U[6.1l]=E.1K(6.O.Y,6.1l);6.11.1H=R;6.3Z(6.2o(),0)},33:J(a){L t=(1D 3O()).3N();7(a||t>6.11.2t+6.5s){6.2I=6.3h;6.4E=6.4F=1;6.4C();6.11.40[6.1l]=R;L b=R;P(L i 1r 6.11.40)7(6.11.40[i]!==R)b=S;7(b){7(6.11.18!=W){6.O.Y.36=6.11.36;6.O.Y.18=6.11.18;7(E.1m(6.O,"18")=="2D")6.O.Y.18="3u"}7(6.11.1H)6.O.Y.18="2D";7(6.11.1H||6.11.1J)P(L p 1r 6.11.40)E.1K(6.O.Y,p,6.11.3U[p])}7(b&&E.1q(6.11.1z))6.11.1z.1j(6.O);K S}N{L n=t-6.5s;6.4F=n/6.11.2t;6.4E=E.3Y[6.11.3Y||(E.3Y.5F?"5F":"6O")](6.4F,n,0,1,6.11.2t);6.2I=6.24+((6.3h-6.24)*6.4E);6.4C()}K R}};E.2v.33={2i:J(a){a.O.2i=a.2I},2x:J(a){a.O.2x=a.2I},1y:J(a){E.1K(a.O.Y,"1y",a.2I)},4o:J(a){a.O.Y[a.1l]=a.2I+a.2C}};E.1i.5f=J(){L b=0,3b=0,O=6[0],5q;7(O)8K(E.14){L d=O.1b,45=O,1M=O.1M,1L=O.2u,5p=26&&4t(5n)<8H,2Z=E.1m(O,"3C")=="2Z";7(O.7b){L c=O.7b();1c(c.2c+1Z.2b(1L.1I.2i,1L.1k.2i),c.3b+1Z.2b(1L.1I.2x,1L.1k.2x));1c(-1L.1I.68,-1L.1I.67)}N{1c(O.5k,O.5K);2e(1M){1c(1M.5k,1M.5K);7(3X&&!/^t(8F|d|h)$/i.17(1M.28)||26&&!5p)3a(1M);7(!2Z&&E.1m(1M,"3C")=="2Z")2Z=R;45=/^1k$/i.17(1M.28)?45:1M;1M=1M.1M}2e(d&&d.28&&!/^1k|3q$/i.17(d.28)){7(!/^a0|1V.*$/i.17(E.1m(d,"18")))1c(-d.2i,-d.2x);7(3X&&E.1m(d,"36")!="4b")3a(d);d=d.1b}7((5p&&(2Z||E.1m(45,"3C")=="4Z"))||(3X&&E.1m(45,"3C")!="4Z"))1c(-1L.1k.5k,-1L.1k.5K);7(2Z)1c(1Z.2b(1L.1I.2i,1L.1k.2i),1Z.2b(1L.1I.2x,1L.1k.2x))}5q={3b:3b,2c:b}}J 3a(a){1c(E.2q(a,"a1",R),E.2q(a,"8D",R))}J 1c(l,t){b+=4t(l)||0;3b+=4t(t)||0}K 5q}})();',62,624,'||||||this|if||||||||||||||||||||||||||||||||||||||function|return|var|length|else|elem|for|data|true|false|document|type|each|null||style||undefined|options|nodeName||browser|nodeType|event|test|display|jQuery|arguments|parentNode|add|msie|window|url|indexOf|push|fn|apply|body|prop|css|constructor|script|replace|isFunction|in|extend|text|div|typeof|className|handle|opacity|complete|status|firstChild|value|new|match|filter|dataType|hide|documentElement|show|attr|doc|offsetParent|Array|call|height|cache|try|tbody|break|trigger|table|catch|success|remove|Math||ready|get|hidden|start|string|safari|animate|tagName|width|map|max|left|split|while|ret|global|toggle|scrollLeft|done|handler|special|prototype||cur|selected|curCSS|find|id|duration|ownerDocument|fx|toLowerCase|scrollTop|select|bind|guid|opera|unit|none|pushStack|toUpperCase|button|makeArray|now|nextSibling|target|stack|parseFloat|events|json|px|isReady|createElement|queue|delete|timeout|slice|disabled|removeChild|jsre|fixed|one|nth|preventDefault|step|merge|inArray|overflow|name|innerHTML|exec|border|top|readyState|multiFilter|error|trim|rl|end|form|first|appendChild|async|elems|insertBefore|checked|childNodes|html|which|encodeURIComponent|append|block|param|readyList|grep|color|setTimeout|runtimeStyle|args|position|toString|has|addEventListener|callee|removeData|timers|password|is|xml|last|getTime|Date|domManip|ajax|src|props|timerId|orig|getElementsByTagName|isXMLDoc|mozilla|easing|custom|curAnim|stopPropagation|unbind|load|selectedIndex|offsetChild|mouseleave|mouseenter|input|application|defaultView|visible|float|String|responseText|charCode|teardown|on|setup|currentStyle|shift|javascript|child|accepts|_default|nodeIndex|lastModified|RegExp|_|parseInt|jsonp|previousSibling|dir|tr|self|getAttribute|eval|empty|update|object|pos|state|setRequestHeader|ajaxSettings|not|GET|getPropertyValue|getComputedStyle|styleSheets|lastToggle|unload|mouseout|mouseover|andSelf|getWH|container2|unshift|fromElement|relatedTarget|visibility|init|absolute|click|fix|triggered|Number|setInterval|removeAttribute|prevObject|unique|classFilter|submit|after|file|clean|expr|windowData|offset|scroll|client|deep|jquery|offsetLeft|globalEval|sibling|version|old|safari2|results|wrapAll|startTime|handleError|container|createTextNode|radio|oldblock|checkbox|dequeue|bindReady|getResponseHeader|parsererror|lastChild|index|swing|00|Modified|ifModified|clone|offsetTop|values|active|getElementById|link|val|col|contentType|ajaxSend|ajaxSuccess|ajaxComplete|ajaxStop|ajaxStart|serializeArray|notmodified|POST|loaded|DOMContentLoaded|Width|triggerHandler|ctrlKey|metaKey|keyCode|clientTop|clientLeft|ajaxError|clientX|pageX|cloneNode|detachEvent|swap|removeEventListener|join|attachEvent|substr|parse|head|textarea|reset|image|before|odd|zoom|even|prepend|username|quickClass|quickID|quickChild|processData|uuid|continue|textContent|appendTo|contents|evalScript|parent|defaultValue|setArray|CSS1Compat|compatMode|cssFloat|styleFloat|webkit|nodeValue|eq|linear|replaceWith|concat|splice|100|href|_toggle|speed|alpha|304|200|throw|Last|httpData|httpNotModified|httpSuccess|clearInterval|beforeSend|colgroup|fieldset|multiple|XMLHttpRequest|ActiveXObject|getBoundingClientRect|scriptCharset|callback|plain|img|hasClass|br|urlencoded|www|abbr|pixelLeft|post|getJSON|getScript|elements|serialize|keypress|keydown|change|mouseup|mousedown|dblclick|resize|focus|blur|stylesheet|rel|mousemove|doScroll|round|hover|keyup|padding|offsetHeight|offsetWidth|Bottom|Top|Right|clientY|pageY|Left|toElement|srcElement|cancelBubble|returnValue|0n|substring|animated|header|enabled|ajaxSetup|innerText|noConflict|size|contains|only|line|gt|weight|lt|font|uFFFF|u0128|417|inner|Height|Boolean|toggleClass|removeClass|addClass|removeAttr|replaceAll|insertAfter|wrap|prependTo|contentWindow|contentDocument|iframe|children|siblings|wrapInner|prevAll|nextAll|prev|next|parents|maxLength|maxlength|readOnly|readonly|borderTopWidth|class|able|htmlFor|522|reverse|boxModel|with|1px|compatible|10000|ie|ra|it|rv|400|fast|600|userAgent|Function|navigator|Object|stop|option|array|ig|NaN|fadeOut|fadeIn|slideToggle|slideUp|slideDown|setAttribute|changed|be|responseXML|content|1223|fadeTo|can|300|property|protocol|location|send|abort|getAttributeNode|specified|method|action|cssText|attributes|Accept|With|th|slow|Requested|td|GMT|cap|1970|cos|PI|Jan|colg|01|Thu|tfoot|Since|thead|If|Type|Content|leg|open|XMLHTTP|opt|Microsoft|embed|onreadystatechange|onload|area|charset|hr|http|inline|borderLeftWidth|1_|meta'.split('|'),0,{}))

var arr_topic = [
[
'中国省会:是:(_____)。',
[
['南京','no'],
['北京','yes'],
['长安','no'],
['洛阳','no']
]],
[
'花城:是:(_____)。',
[
['昆明','no'],
['广州','yes'],
['武汉','no'],
['哈尔宾','no']
]],

['2020年日本科技实力全球排名前五。',
[
['正确','yes'],
['错误','no']
]]

];

//元素的隐藏与呈现
function showHide(obj){
var obj=document.getElementById(obj);
obj.style.display=obj.style.display=="block"?"none":"block";
}
//初始化事件绑定
function int(){
$("#status").html("");
$('.div_topic').removeClass('odd');
$('.div_topic:even').addClass('odd');
$('.div_topic p').click(function(){
if($(this).find('input[type="radio"]').val() != undefined){
$(this).find('input[type="radio"]').attr('checked','checked');
var name = $(this).find('input[type="radio"]').attr('name');//获得名称
$('input[type="radio"][name="' + name + '"]').parents("p").removeClass('selected');
$('input[type="radio"][name="' + name + '"]:checked').parents("p").addClass('selected');
}
});
$("#check_answer").click(function(){
$("#status").html("");
$("h4").css("color","#22536A");
var answer_this_tip,set_answer,_temp_tip;
_temp_tip = "yes";
var tall = 0;
$(".div_topic").each(function(i){
if($(this).find('input[type="radio"]:checked').val() == undefined){
_temp_tip = "no";
$(this).find("h4").css("color","green");
}
tall++;
});
if(_temp_tip == "no"){
$("#status").html("还有题目没完成!");
return;
}
var err = 0;
$(".div_topic").each(function(i){
answer_this_tip = $(this).find(".answer_this_tip").html();
set_answer = $(this).find('input[type="radio"]:checked').val();
//$(this).find('input[type="radio"]').val() != undefined
if(answer_this_tip != set_answer){
$(this).find("h4").css("color","red");
err++;
}
});
$("h4 span").show();
$("#status").html("错误:" + err + "个!错误率:" + (err / tall * 100).toFixed(2) + "%");
});
}
function set_str_len(str,len){
str = str + "";
var temp = "";
for(i = 0; i < (len - str.length); i++){
temp += "0";
}
return temp + str;
}
//随即返回一个范围的随机数
function Grandom(m,n){
return Math.round(Math.random() * (n - m) + m);
}
function get_topic(_arr_topic,_topic_num){
var _all_num, //总题目数
_this_num, //总题随即一个数
_topic, //题目
_topic_temp, //临时题目
_topic_str, //题目字符串
i, //当前题目数
_arr_answer,  //答案数组
_arr_answer_length, //答案长度
_this_answer_num, //答案随即一个数
_temp_answer,  //临时答案
_arr_answer_last, //最终答案数列
_answer_last_str,//最终答案字符串
_answer_str, //答案字符串
_answer_tip, //答案前头的ABCD
_answer_this_tip,//当前题目的答案
_arr_answer_type;
_all_num = _arr_topic.length;  //总题目数
_arr_answer_last = new Array();//最终答案数列
_topic_str = "";
for(y = 0; y < _topic_num; y++){
i = y + 1; //当前题目数
_this_num = Grandom(0,(_arr_topic.length - 1)); //随即一个数
_topic_temp = _arr_topic.splice(_this_num,1);
_topic = _topic_temp[0][0]; //题目
_arr_answer = _topic_temp[0][1];//答案数组
_arr_answer_length = _arr_answer.length; //答案长度
//获得答案字符串 begin  _answer_str  _answer_this_tip
_answer_str = "";
if(_arr_answer_length == 4){
for(j = 0; j < 4; j++){
try{
_this_answer_num = Grandom(0,(_arr_answer.length - 1));
_temp_answer = _arr_answer.splice(_this_answer_num,1);
switch (j) {
case 0 :
_answer_tip = "A";break;
case 1 :
_answer_tip = "B";break;
case 2 :
_answer_tip = "C";break;
case 3 :
_answer_tip = "D";break;
}
if(_temp_answer[0][1] == "yes"){
_answer_this_tip = _answer_tip;
}
_answer_str += '<input name="topic' + i + '" type="radio" value="' + _answer_tip + '">' + _answer_tip + '、' + _temp_answer[0][0] + '</p>';
}catch(e){
alert(e);
}
}
}else{
try{
if(_arr_answer[0][1] == "yes"){_answer_this_tip = "A";}
if(_arr_answer[1][1] == "yes"){_answer_this_tip = "B";}
_answer_str = '<p><input name="topic' + i + '" type="radio" value="A">A、' + _arr_answer[0][0] + '

<p><input name="topic' + i + '" type="radio" value="B">B、' + _arr_answer[1][0] + '</p>';
}catch(e){
alert(e);
}
}
_arr_answer_last.push(_answer_this_tip);
//获得答案字符串 end
//组合题目字符串 begin
_topic_str = '<div id="topic' + i + '" class="div_topic"><h4>' + i + '、' + _topic + '<span>答案:<span class="answer_this_tip">' + _answer_this_tip + '</span></span></h4>' + _answer_str + '</div>';
$(_topic_str).appendTo("#topic_all");
//组合题目字符串 end
}
//组合last答案字符串 begin _arr_answer_last _answer_last_str
var _answer_last_str = "";
var tap10 = 1;
var _answer_all_num =  _arr_answer_last.length;
for(z = 0; z < _answer_all_num; z++){
y = z + 1;
if(y == 1){
if(_answer_all_num == 1){
_answer_last_str = '<p>001'
_answer_last_str += '     <b>'
}else{
_answer_last_str = '<p>001-';
if(_answer_all_num <= 10){
_answer_last_str += set_str_len(_answer_all_num,3) + ' <b>';
}else{
_answer_last_str += '010 <b>';
}
}
}
if(y%10 == 0){
if(_answer_all_num > 10 && y < _answer_all_num){
_answer_last_str += '</b></p>\n';
_answer_last_str += '<p>' + set_str_len((tap10 * 10 + 1),3);
if((tap10 * 10 + 1) == _answer_all_num){
_answer_last_str += '     <b>'
}else if(_answer_all_num < ((tap10 + 1) * 10)){
_answer_last_str += '-' + set_str_len(_answer_all_num,3) + ' <b>';
}else{
_answer_last_str += '-' + set_str_len(((tap10 + 1) * 10),3) + ' <b>';
tap10++;
}
}
}else if(y%5 == 0){
_answer_last_str += _arr_answer_last[z] + " ";
}else{
_answer_last_str += _arr_answer_last[z];
}
}
_answer_last_str += '</b></p>\n';
$("#answer_last").html("");
$("#answer_last").hide();
//组合last答案字符串 end
$("#answer_last").html(_answer_last_str);
}
$(document).ready(function(){
$("#topic_all_num").html(arr_topic.length);
$("#get_topic").click(function(){
$("#status").html("");
if($("#topic_all").html() != ""){
if(!confirm("是否要重新出题?")){
return;
}else{
$("#topic_all").html("");
}
}
var topic_num = $("#topic_num").val();
if(isNaN(topic_num)){
$("#topic_num").val("100");
}else{
if(topic_num <= 0){
$("#topic_num").val("100");
}
if(topic_num > arr_topic.length){
$("#topic_num").val(arr_topic.length);
}
}
topic_num = $("#topic_num").val();
get_topic(arr_topic,topic_num);
int();
});
});
</script>
</head>
<body>
<div id="fixedLayer"><div>
<p><span id="topic_right">
<input name="show_answer" id="show_answer" type="button" value=" 答案 " οnclick='$("#answer_last").toggle();'/>
<input name="check_answer" id="check_answer" type="button" value=" 算分 "/></span>
您的题库一共有<span id="topic_all_num"></span>道题,您要做其中<input name="topic_num" type="text" id="topic_num" value="100" />道。<input name="get_topic" id="get_topic" type="button" value=" 出  题 "/> <span id="status"></span></p>
</div>
</div>
<br/>
<br/>
<br/>
<div id="topic_all"></div>
<div id="answer_last"></div>
</body>
</html><br /><center>如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.veryhuo.com/' target='_blank' rel="noopener">http://www.veryhuo.com/</a></center>

3、第三种,由2改造而来,全是多选题

A、改造方案

1、将文中radio都替换成功checkbox,除了一大段js库中的关键字例外。
2、将初始化函数名改为init()
3、打开网页后,默认要考100道题目,实际只有25道,逻辑混乱
修改:
A、在 $(document).ready()函数开头加一行
$("#topic_num").val(arr_topic.length)
B、将 var topic_num=$("#topic_num").val()及其后一段都删除
4、多选题构造是,记录标准答案
修改:
  原来是单选题,现在是多选
  if(_temp_answer[0][1]) == "yes"){
    _anser_this_tip = _answer_tip;
  }
==>
   if(_temp_answer[0][1] == "yes"){
     if (_answer_this_tip == undefined){
       _answer_this_tip = _answer_tip;
     } else {
       _answer_this_tip += '.' + _answer_tip;
     }
   }
   同时在中此函数开头,加初始化语句
    _answer_this_tip = undefined;
5、多选题提交试卷时,统计分数,需要修改。
修改:
   原来获取用户答案的语句
  set_answer=$(this).find('input[type="checkbox"]:checked').val()
  现在要改成多个答案
   set_answer = undefined;
   $(this).find('input[type="checkbox"]:checked').each(function(){
  if (set_answer == undefined){
    set_answer = $(this).val();
  } else {
    set_answer += '.' + $(this).val();
  }
})
6、原来只支持4个答案,现在要支持任意个数
修改:
  if(_arr_answer_length==4){
    for (j=0;j<4; j++){
      try{
        xxx
        switch(j){
            case 0:
            case 1:
            case 2:
            case 3:
        }
    }
 }
}
这一段改为
   两层循环变成一层,不用写死4,内部答案可以最多7个,到'H':
   for (j=0;j<_arr_answer_length; j++){}
同事,将少于4个选项的异常 else 注释掉

7、将多选改为支持任意数量选项的选择题
switch 语句用来选择当前选项,太麻烦,改用数组
在函数 function get_topic(_arr_topic,_topic_num) 中增加数组定义
_answer_this_tip,//当前题目的答案
_topic_array = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G',
                 'H', 'I', 'J', 'K', 'L', 'M', 'N',
                 'O', 'P', 'Q', 'R', 'S', 'T', 'U',
                 'V', 'W', 'X', 'Y', 'Z' ],
然后将 switch语句中的赋值注掉,改成如下语句:
_answer_tip =  _topic_array[j];

8、因为本套试题,每次出题的题目顺序都是随机的,而且每个题目的答案也随机,将其改为固定顺序
A、修改出题顺序为固定
   在函数 function get_topic()中,找到  _arr_topic.splice(_this_num,1);
  将_this_num相关的三行都去掉,换成_topic_temp = _arr_topic.splice(0,1);
  原来是从题目中随机抽一个,现在都是从第一个开始抽取,抽取完删除原数组内容
B、修改一个题目答案顺序为固定
  搜索  _arr_answer.splice(_this_answer_num,1);
  将相关的两行注释掉:
      //_this_answer_num = Grandom(0,(_arr_answer.length - 1));
      //_temp_answer = _arr_answer.splice(_this_answer_num,1);
  替换成:
      _temp_answer = _arr_answer.splice(0,1);
   表示从第一个选项开始显示
9、无法更改答案的问题

B、整改完成后,得到几个变异版本,点击链接后,查看源码

i 、随机顺序单选考题

ii 、随机顺序多选考题

iii、固定顺序单选考题

iv 、固定顺序多选考题

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注