js2级联动 并js鼠标悬停显示文字字

JS经典的省份城市二级联动菜单_网页特效代码,网页特效代码大全集锦-芯晴网页特效_
当前位置: /
JS经典的省份城市二级联动菜单
分类:
发布日期:
&title&JS经典的省份城市二级联动菜单丨芯晴网页特效丨&/title&
&script language=&javascript&&
cityareaname=new Array(35);
cityareacode=new Array(35);
function first(preP,preC,formname,selectP,selectC)
if (selectP=='01')
{ a=1;tempoption=new Option('北京','01',false,true); }
{ tempoption=new Option('北京','01'); }
eval('document.'+formname+'.'+preP+'.options[1]=');
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); }
{ tempoption=new Option('深圳','02'); }
eval('document.'+formname+'.'+preP+'.options[2]=');
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); }
{ tempoption=new Option('上海','03'); }
eval('document.'+formname+'.'+preP+'.options[3]=');
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); }
{ tempoption=new Option('重庆','04'); }
eval('document.'+formname+'.'+preP+'.options[4]=');
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); }
{ tempoption=new Option('天津','05'); }
eval('document.'+formname+'.'+preP+'.options[5]=');
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); }
{ tempoption=new Option('广东','06'); }
eval('document.'+formname+'.'+preP+'.options[6]=');
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); }
{ tempoption=new Option('河北','07'); }
eval('document.'+formname+'.'+preP+'.options[7]=');
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); }
{ tempoption=new Option('山西','08'); }
eval('document.'+formname+'.'+preP+'.options[8]=');
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); }
{ tempoption=new Option('内蒙古','09'); }
eval('document.'+formname+'.'+preP+'.options[9]=');
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); }
{ tempoption=new Option('辽宁','10'); }
eval('document.'+formname+'.'+preP+'.options[10]=');
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); }
{ tempoption=new Option('吉林','11'); }
eval('document.'+formname+'.'+preP+'.options[11]=');
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); }
{ tempoption=new Option('黑龙江','12'); }
eval('document.'+formname+'.'+preP+'.options[12]=');
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); }
{ tempoption=new Option('江苏','13'); }
eval('document.'+formname+'.'+preP+'.options[13]=');
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); }
{ tempoption=new Option('浙江','14'); }
eval('document.'+formname+'.'+preP+'.options[14]=');
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); }
{ tempoption=new Option('安徽','15'); }
eval('document.'+formname+'.'+preP+'.options[15]=');
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); }
{ tempoption=new Option('福建','16'); }
eval('document.'+formname+'.'+preP+'.options[16]=');
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); }
{ tempoption=new Option('江西','17'); }
eval('document.'+formname+'.'+preP+'.options[17]=');
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); }
{ tempoption=new Option('山东','18'); }
eval('document.'+formname+'.'+preP+'.options[18]=');
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); }
{ tempoption=new Option('河南','19'); }
eval('document.'+formname+'.'+preP+'.options[19]=');
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); }
{ tempoption=new Option('湖北','20'); }
eval('document.'+formname+'.'+preP+'.options[20]=');
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); }
{ tempoption=new Option('湖南','21'); }
eval('document.'+formname+'.'+preP+'.options[21]=');
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); }
{ tempoption=new Option('广西','22'); }
eval('document.'+formname+'.'+preP+'.options[22]=');
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); }
{ tempoption=new Option('海南','23'); }
eval('document.'+formname+'.'+preP+'.options[23]=');
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); }
{ tempoption=new Option('四川','24'); }
eval('document.'+formname+'.'+preP+'.options[24]=');
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); }
{ tempoption=new Option('贵州','25'); }
eval('document.'+formname+'.'+preP+'.options[25]=');
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); }
{ tempoption=new Option('云南','26'); }
eval('document.'+formname+'.'+preP+'.options[26]=');
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); }
{ tempoption=new Option('西藏','27'); }
eval('document.'+formname+'.'+preP+'.options[27]=');
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); }
{ tempoption=new Option('陕西','28'); }
eval('document.'+formname+'.'+preP+'.options[28]=');
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); }
{ tempoption=new Option('甘肃','29'); }
eval('document.'+formname+'.'+preP+'.options[29]=');
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); }
{ tempoption=new Option('青海','30'); }
eval('document.'+formname+'.'+preP+'.options[30]=');
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); }
{ tempoption=new Option('宁夏','31'); }
eval('document.'+formname+'.'+preP+'.options[31]=');
cityareacode[30]=new Array('3101','3102','3103','3104');
cityareaname[30]=new Array('银川','石嘴山','银南','固原');
if (selectP=='32')
{ a=32;tempoption=new Option('新疆','32',false,true); }
{ tempoption=new Option('新疆','32'); }
eval('document.'+formname+'.'+preP+'.options[32]=');
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); }
{ tempoption=new Option('香港','33'); }
eval('document.'+formname+'.'+preP+'.options[33]=');
cityareacode[32]=new Array();
cityareaname[32]=new Array();
if (selectP=='34')
{ a=34;tempoption=new Option('澳门','34',false,true); }
{ tempoption=new Option('澳门','34'); }
eval('document.'+formname+'.'+preP+'.options[34]=');
cityareacode[33]=new Array();
cityareaname[33]=new Array();
if (selectP=='35')
{ a=35;tempoption=new Option('台湾','35',false,true); }
{ tempoption=new Option('台湾','35'); }
eval('document.'+formname+'.'+preP+'.options[35]=');
cityareacode[34]=new Array();
cityareaname[34]=new Array();
eval('document.'+formname+'.'+preP+'.options[a].selected=');
cityid=selectP;
if (cityid!='0')
b=0;for (i=0;i&cityareaname[cityid-1].i++)
if (selectC==cityareacode[cityid-1][i])
{b=i+1;tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i],false,true);}
tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i]);
eval('document.'+formname+'.'+preC+'.options[i+1]=');
eval('document.'+formname+'.'+preC+'.options[b].selected=');
function selectcityarea(preP,preC,formname)
cityid=eval('document.'+formname+'.'+preP+'.selectedI');
j=eval('document.'+formname+'.'+preC+'.');
for (i=1;i&j;i++)
{eval('document.'+formname+'.'+preC+'.options[j-i]=')}
if (cityid!=&0&)
for (i=0;i&cityareaname[cityid-1].i++)
tempoption=new Option(cityareaname[cityid-1][i],cityareacode[cityid-1][i]);
eval('document.'+formname+'.'+preC+'.options[i+1]=');
&form action=&file:///C|/Program%20Files/Macromedia/Dreamweaver%204/Lessons/Lesson%20Files/info_search.asp?martid=& method=post name=form1&
&img src=&file:///C|/Program%20Files/Macromedia/Dreamweaver%204/images/w_KT.gif& height=&6& width=&1& onload=&return imgzoom(this,600);& onclick=&javascript:window.open(this.src);& style=&cursor:&/&
&table width=300
border=0 cellspacing=&0& cellpadding=&1& !bgcolor=#FFFDE6&
&td class=&black_con9& align=&right&&省份:&/td&
&td class=&black_con9&&
&select name=&selectp& onChange=&selectcityarea('selectp','selectc','form1');&&
&option value=&0& selected&不限--
&td class=&black_con9& align=&right&&县/市:&/td&
&td class=&black_con9&&
&select name=&selectc&&
&option value=&0& selected&不限--
&script language=&javascript&&
first(&selectp&,&selectc&,&form1&,0,0);
&br&&br&&hr&&p align=&center&&&font color=black&本特效由 &a href=&& target=&_blank&&芯晴网页特效&/a&丨 收集于互联网,只为兴趣与学习交流,不作商业用途。&/font&&/p&
提示:可以先修改部分代码后再运行
您可能在找这些
下载积分:免费提供下载
&&&浏览:8469
&&&浏览:372
&&&浏览:117
&&&浏览:7981>>> & select使用js实现简单2级联动 多级联动 &
select使用js实现简单2级联动 多级联动
发布者: 匿名
围观次 点赞:0
对于需要实现省、市选择类的二级关联选择联动的,就需要用到这个功能首先,在select中,value和text的区别在于:value是客户看不见的值;而text是客户可以看见的值。也就是说二级联动(比如常见的选择不同的省份有不同的地区)是在你改变了省份之后,触发事件,传递对应的value给第二级,第二级的select根据你传递的value改变了自己的text值。以此类推,向下传递。&好了上代码!&!doctype&html&
&meta&charset=&utf-8&&
&title&联动&/title&
&select&id=&s1&&onChange=&move()&&
&!--&根据id获取value,onchange()触发函数move()修改二级select的text值实现联动&--&
&&&option&selected&value=&s1&&--&请选择&--&/option&
&&&!--默认选中--&
&&&option&&value=&SC&&SC&/option&
&&&option&&&value=&BJ&&BJ&/option&
&&&option&&&value=&TJ&&TJ&/option&
&select&id=&s2&&
&&&&option&selected&--&请选择&--&/option&
&&&&!--默认选中,动态生成option&--&
&&&&&function&move()
&&&&&&&&&var&s1=document.getElementById(&s1&);
&&&&&&&&&var&s2=document.getElementById(&s2&);
&&&&&&&&&&!--&获取一级和二级的属性--&
&&&&&&&&&var&
&&&&&&&&&if(s1.value==&SC&)
&&&&&&&&&{
&&&&&&&&&&&&&add=new&Array(&CD&,&DZ&,&MY&,&NC&);
&&&&&&&&&&&&&&!--比对value值,实现对应二级text值的动态生成--&
&&&&&&&&&}else&if(s1.value==&BJ&)
&&&&&&&&&{
&&&&&&&&&add=new&Array(&HD&,&CY&,&WFJ&);
&!--比对value值,实现对应二级text值的动态生成--&
&&&&&&&&&}else&if(s1.value==&TJ&)
&&&&&&&&&{
&&&&&&&&&&&&&add=new&Array(&TJG&,&TJ&,&TJY&);
&&&&&&&&&&&&&&!--比对value值,实现对应二级text值的动态生成--&
&&&&&&&&&&&}else&if(s1.value==&s1&)
&&&&&&&&&&{
&&&&&&&&&&&&&&add=new&Array(&请选择&);
&&&&&&&&&&&&}
&&&&&&&&&&else
&&&&&&&&&&{
&&&&&&&&&add=
&&&&&&&&&&!--若没有就为空,当然不可能出现的--&
&&&&&&&&&&}
&&&&&&&&&&s2.length=0;
&&&&&&&&&&for(var&i=0;i&add.i++)
&&&&&&&&&&{
&&&&&&&&&&&&&&var&ss=new&Option();
&&&&&&&&&&&&&&ss.text=add[i].split()[0];
&&&&&&&&&&&&&&s2.add(ss);
&&&&&&&&&&&&&&&!--把text值添加到二级select中,显示出来--&
&&&&&&&&&&}
&/html&效果如下:&默认:&选择BJ:&&选择“请选择”:&&完事,如果想都多级联动以此类推。(比如国家,省份,地区等等)&&
下一篇:没有了
您可能还会对下面的文章感兴趣:21:44 提问
【已解决】下拉框的多级联动,怎么发送消息(两级以上的联动)
就是一个窗口上有多个下拉框
重复类型:
重复周期:
重复时间:
修改第一个重复类型,比如是
按日重复,第二个重复周期的内容变成一号、二号、三号……
按周重复,第二个重复周期的内容变成星期一星期二星期三……
而按周重复我还想将Combo Box改成复选按钮,或许会分成两行,
然后对应的重复时间什么的位置就会跟着下移……
然后再往下其他控件的位置也发生了变化。
内容的联动我已经做好了,通过修改重复类型,产生CBN_SELCHANGE消息,来修改重复周期的内容。
可是这就有个问题,那就是重复类型没有点击之前,重复周期……重复时间等缺省不好做。
像OnCbnSelchangeComtype()事件中那些设置,我倒是可以选一个设置到OnInitDialog里面,可问题不能到这里解决。
修改了重复类型,重写了重复周期,那再往下的重复时间呢?也写在OnCbnSelchangeComtype()里面么?我希望能够在自动变化了周期之后,还能发送一个消息,去换一个事件响应这些变化,去自动变化时间。
我尝试用SendMessage来发送消息,不过没学好,我一时间不明白SendMessage的内容应该怎么写,放控件ID?放消息类型?这两个应该都要放吧,还是使用其他的办法??
这里面我还有很重要的想要解决的问题,那就是界面排版的问题,代码里面写了一个界面排版,并且用自定义消息(Initmove )来调用这个排版,可是这个排版是固定的。
如果我重复类型选择了按周重复,重复周期里面的下拉框隐藏掉,变成七个多选按钮,或许会占据两排三排,然后再往下的重复时间的位置会向下顺延,我总感觉,只要设置一个关联的消息传递就能做到……
思路是:重复类型变化了,传递一个消息给重复周期,我感觉应该也是用CBN_SELCHANGE,比如SendMessage(CBN_SELCHANGE,IDC_COMPER)?这个写法应该是错的,唉,都怪我没学好。
重复周期内容变化了,作出对应代码改变,然后传递消息给下一个重复时间的事件……这样依次传递依次修改,而不是做在同一个事件里面,应该怎么写代码?
可我就是做不到……
`// DATADlg.cpp : 实现文件
#include "stdafx.h"
#include "天星定时器.h"
#include "DATADlg.h"
#include "afxdialogex.h"
initzzw = WM_USER+ 3584,
Initmove = initzzw+1
// DATADlg 对话框
IMPLEMENT_DYNAMIC(DATADlg, CDialogEx)
DATADlg::DATADlg(CWnd* pParent /*=NULL*/)
: CDialogEx(IDD_DATA, pParent)
DATADlg::~DATADlg()
void DATADlg::DoDataExchange(CDataExchange* pDX)
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMTYPE, Comtype);
DDX_Control(pDX, IDC_COMPER, Comper);
DDX_Control(pDX, IDC_COMTIME, Comtime);
DDX_Control(pDX, IDC_STAPER, Staper);
BEGIN_MESSAGE_MAP(DATADlg, CDialogEx)
ON_CBN_SELCHANGE(IDC_COMTYPE, &DATADlg::OnCbnSelchangeComtype)
ON_MESSAGE(Initmove, &DATADlg::OnInitmove)
ON_CBN_SELCHANGE(IDC_COMPER, &DATADlg::OnCbnSelchangeComper)
END_MESSAGE_MAP()
// DATADlg 消息处理程序
BOOL DATADlg::OnInitDialog()
CDialogEx::OnInitDialog();
在此添加额外的初始化
SendMessage(Initmove);
Comtype.AddString(_T("不重复"));
Comtype.AddString(_T("按日重复"));
Comtype.AddString(_T("按周重复"));
Comtype.AddString(_T("按月重复"));
Comtype.AddString(_T("按年重复"));
Comtype.AddString(_T("按自定义重复"));
Comtype.SetCurSel(0);
return TRUE;
// return TRUE unless you set the focus to a control
// 异常: OCX 属性页应返回 FALSE
void DATADlg::OnCbnSelchangeComtype()
GetDlgItemText(IDC_COMTYPE, Text);
if (Text == _T("不重复"))
Comper.ResetContent();
GetDlgItem(IDC_STAPER)-&SetWindowText(_T("不重复"));
else if (Text == _T("按日重复"))
Comper.ResetContent();
Comper.AddString(_T("1"));
Comper.AddString(_T("2"));
Comper.AddString(_T("3"));
Comper.AddString(_T("4"));
Comper.AddString(_T("5"));
Comper.AddString(_T("6"));
Comper.AddString(_T("7"));
Comper.AddString(_T("8"));
Comper.AddString(_T("9"));
Comper.AddString(_T("10"));
Comper.SetCurSel(0);
GetDlgItem(IDC_STAPER)-&SetWindowText(_T("日"));
else if (Text == _T("按周重复"))
Comper.ResetContent();
Comper.AddString(_T("星期一"));
Comper.AddString(_T("星期二"));
Comper.AddString(_T("星期三"));
Comper.AddString(_T("星期四"));
Comper.AddString(_T("星期五"));
Comper.AddString(_T("星期六"));
Comper.AddString(_T("星期天"));
Comper.SetCurSel(0);
GetDlgItem(IDC_STAPER)-&SetWindowText(_T(" "));
else if (Text == _T("按月重复"))
Comper.ResetContent();
Comper.AddString(_T("1"));
Comper.AddString(_T("2"));
Comper.AddString(_T("3"));
Comper.AddString(_T("4"));
Comper.AddString(_T("5"));
Comper.AddString(_T("6"));
Comper.AddString(_T("7"));
Comper.AddString(_T("8"));
Comper.AddString(_T("9"));
Comper.AddString(_T("10"));
Comper.SetCurSel(0);
GetDlgItem(IDC_STAPER)-&SetWindowText(_T("月"));
else if (Text == _T("按年重复"))
Comper.ResetContent();
Comper.AddString(_T("1"));
Comper.AddString(_T("2"));
Comper.AddString(_T("3"));
Comper.AddString(_T("4"));
Comper.AddString(_T("5"));
Comper.AddString(_T("6"));
Comper.AddString(_T("7"));
Comper.AddString(_T("8"));
Comper.AddString(_T("9"));
Comper.AddString(_T("10"));
Comper.SetCurSel(0);
GetDlgItem(IDC_STAPER)-&SetWindowText(_T("年"));
else if (Text == _T("按自定义重复"))
GetDlgItem(IDC_STAPER)-&SetWindowText(_T("自定义"));
//Comper.ResetContent();
//MessageBox(_T("找到了") + Text);
SendMessage(IDC_COMPER, CBN_SELCHANGE);
// TODO: 在此添加控件通知处理程序代码
afx_msg LRESULT DATADlg::OnInitmove(WPARAM wParam, LPARAM lParam)
//定义左半边的位置,设定X1;
int x1=5, x2, y1=5, y2, x3;
CRect EDITrect, STXNR
GetDlgItem(IDC_EDIT)-&GetWindowRect(&EDITrect);
GetDlgItem(IDC_STATICTXNR)-&GetWindowRect(&STXNRrect);
STXNRrect.MoveToXY(x1, y1);
EDITrect.MoveToXY(STXNRrect.TopLeft().x, STXNRrect.TopLeft().y + STXNRrect.Height());
GetDlgItem(IDC_STATICTXNR)-&MoveWindow(STXNRrect);//移动到目标位置
GetDlgItem(IDC_EDIT)-&MoveWindow(EDITrect);//移动到目标位置
x2 = EDITrect.right + 30;
//定义右半边 提醒时间等文字的x点
//第一行 提醒时间
CRect STXSJrect, DATErect, TIME
GetDlgItem(IDC_STATICTXSJ)-&GetWindowRect(&STXSJrect);
GetDlgItem(IDC_DATE)-&GetWindowRect(&DATErect);
GetDlgItem(IDC_TIME)-&GetWindowRect(&TIMErect);
DATErect.MoveToY(0);
TIMErect.MoveToY(0);
y2 = (TIMErect.Height() - STXSJrect.Height()) / 2;
STXSJrect.MoveToXY(x2, y2);
GetDlgItem(IDC_STATICTXSJ)-&MoveWindow(STXSJrect);
x3 = STXSJrect.//确定后面所有X3的位置
DATErect.MoveToX(x3);
GetDlgItem(IDC_DATE)-&MoveWindow(DATErect);
TIMErect.MoveToX(DATErect.right);
GetDlgItem(IDC_TIME)-&MoveWindow(TIMErect);
y2 = TIMErect.bottom + 5;
//第二行 重复类型
CRect SCFLX//重复类型文字
CRect TYPE//重复类型下拉框
GetDlgItem(IDC_STATICCFLX)-&GetWindowRect(&SCFLXrect);
GetDlgItem(IDC_COMTYPE)-&GetWindowRect(&TYPErect);
TYPErect.MoveToXY(x3,y2);
SCFLXrect.MoveToXY(x2, y2 + (TYPErect.Height() - SCFLXrect.Height()) / 2);
GetDlgItem(IDC_STATICCFLX)-&MoveWindow(SCFLXrect);
GetDlgItem(IDC_COMTYPE)-&MoveWindow(TYPErect);
y2 = TYPErect.bottom + 5;
//第三行 重复周期
CRect SCFZQ//重复周期
CRect SM//文字:每
CRect PER//重复周期下拉框
CRect SPER//重复周期天、日、月、年…等文字
GetDlgItem(IDC_STATICCFZQ)-&GetWindowRect(&SCFZQrect);
GetDlgItem(IDC_STATICM)-&GetWindowRect(&SMrect);
GetDlgItem(IDC_COMPER)-&GetWindowRect(&PERrect);
GetDlgItem(IDC_STAPER)-&GetWindowRect(&SPERrect);
PERrect.MoveToY(y2);
y2 = (PERrect.Height() - SCFZQrect.Height()) / 2 + y2;
SCFZQrect.MoveToXY(x2, y2);
GetDlgItem(IDC_STATICCFZQ)-&MoveWindow(SCFZQrect);
SMrect.MoveToXY(x3, y2);
GetDlgItem(IDC_STATICM)-&MoveWindow(SMrect);
PERrect.MoveToX(SMrect.right);
GetDlgItem(IDC_COMPER)-&MoveWindow(PERrect);
SPERrect.MoveToXY(PERrect.right, y2);
GetDlgItem(IDC_STAPER)-&MoveWindow(SPERrect);
y2 = PERrect.bottom+5;//上一行结束之后,更新下一行的高度
//第四行 重复时间
CRect SCFSJ//重复时间
CRect CTIME//重复时间下拉框
GetDlgItem(IDC_STATICCFSJ)-&GetWindowRect(&SCFSJrect);
GetDlgItem(IDC_COMTIME)-&GetWindowRect(&CTIMErect);
CTIMErect.MoveToY(y2);
SCFSJrect.MoveToXY(x2, (CTIMErect.Height()- SCFSJrect.Height())/2+y2);
GetDlgItem(IDC_STATICCFSJ)-&MoveWindow(SCFSJrect);
CTIMErect.MoveToX(x3);
GetDlgItem(IDC_COMTIME)-&MoveWindow(CTIMErect);
y2 = CTIMErect.bottom + 5;//上一行结束之后,更新下一行的高度
//第五行 结束条件
CRect SJSTJ//结束条件
CRect RNO//从不结束条件
GetDlgItem(IDC_STATICJSTJ)-&GetWindowRect(&SJSTJrect);
GetDlgItem(IDC_RADIONO)-&GetWindowRect(&RNOrect);
RNOrect.MoveToXY(x3,y2);
SJSTJrect.MoveToXY(x2, (RNOrect.Height() - SJSTJrect.Height()) / 2 + y2);
GetDlgItem(IDC_STATICJSTJ)-&MoveWindow(SJSTJrect);
GetDlgItem(IDC_RADIONO)-&MoveWindow(RNOrect);
y2 = RNOrect.bottom+5;
CRect RFRErect, CFRErect, SFRE//发生X次之后结束
GetDlgItem(IDC_RADIOFRE)-&GetWindowRect(&RFRErect);
GetDlgItem(IDC_COMFRE)-&GetWindowRect(&CFRErect);
GetDlgItem(IDC_STATICFRE)-&GetWindowRect(&SFRErect);
CFRErect.MoveToY(y2);
RFRErect.MoveToXY(x3, (CFRErect.Height() - RFRErect.Height()) / 2 + y2);
CFRErect.MoveToX(RFRErect.right);
SFRErect.MoveToXY(CFRErect.right, (CFRErect.Height() - SFRErect.Height()) / 2 + y2);
GetDlgItem(IDC_RADIOFRE)-&MoveWindow(RFRErect);
GetDlgItem(IDC_COMFRE)-&MoveWindow(CFRErect);
GetDlgItem(IDC_STATICFRE)-&MoveWindow(SFRErect);
y2 = CFRErect.bottom + 5;
CRect RTIMEJS, CTIMEJS, STIMEJS;//在X时间之后结束
GetDlgItem(IDC_RADIOTIMEJS)-&GetWindowRect(&RTIMEJS);
GetDlgItem(IDC_COMTIMEJS)-&GetWindowRect(&CTIMEJS);
GetDlgItem(IDC_STATICTIMEJS)-&GetWindowRect(&STIMEJS);
CTIMEJS.MoveToY(y2);
RTIMEJS.MoveToXY(x3, (CTIMEJS.Height() - RTIMEJS.Height()) / 2 + y2);
CTIMEJS.MoveToX(RTIMEJS.right);
STIMEJS.MoveToXY(CTIMEJS.right, (CTIMEJS.Height() - STIMEJS.Height()) / 2 + y2);
GetDlgItem(IDC_RADIOTIMEJS)-&MoveWindow(RTIMEJS);
GetDlgItem(IDC_COMTIMEJS)-&MoveWindow(CTIMEJS);
GetDlgItem(IDC_STATICTIMEJS)-&MoveWindow(STIMEJS);
y2 = CTIMEJS.bottom + 5;
//第六行 执行事件
CRect SZXSJ,RTQTX,CTQTX,STQTX;//执行事件,提前N分钟提醒
GetDlgItem(IDC_STAZXSJ)-&GetWindowRect(&SZXSJ);
GetDlgItem(IDC_RADTQTX)-&GetWindowRect(&RTQTX);
GetDlgItem(IDC_COMTQTX)-&GetWindowRect(&CTQTX);
GetDlgItem(IDC_STATQTX)-&GetWindowRect(&STQTX);
CTQTX.MoveToY(y2);
SZXSJ.MoveToXY(x2, (CTQTX.Height() - SZXSJ.Height()) / 2 + y2);
RTQTX.MoveToXY(x3, (CTQTX.Height() - RTQTX.Height()) / 2 + y2);
CTQTX.MoveToX(RTQTX.right);
STQTX.MoveToXY(CTQTX.right, (CTQTX.Height() - STQTX.Height()) / 2 + y2);
GetDlgItem(IDC_STAZXSJ)-&MoveWindow(SZXSJ);
GetDlgItem(IDC_RADTQTX)-&MoveWindow(RTQTX);
GetDlgItem(IDC_COMTQTX)-&MoveWindow(CTQTX);
GetDlgItem(IDC_STATQTX)-&MoveWindow(STQTX);
y2 = CTQTX.bottom + 5;
CRect RYXRJ;//运行软件
GetDlgItem(IDC_RADYXRJ)-&GetWindowRect(&RYXRJ);
RYXRJ.MoveToXY(x3,y2);
GetDlgItem(IDC_RADYXRJ)-&MoveWindow(RYXRJ);
y2 = RYXRJ.bottom + 5;
y2 = RNOrect.bottom + 5;//上一行结束之后,更新下一行的高度
void DATADlg::OnCbnSelchangeComper()
// TODO: 在此添加控件通知处理程序代码
按赞数排序
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!
其他相关推荐}

我要回帖

更多关于 js文字超出显示省略号 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信