remore addr php,根据用户ip地址提示选择城市php代码

@charset "utf-8";

/* css document */

#getplatform {

position: absolute;

visibility: hidden;

width: 180px !important;

border: 1px solid #77c608;

background: #fcfcfc;

cursor: pointer;

color: #ff7a23;

list-style-type: none;

z-index: 9999;

}

.hint {

width: 180px;

padding-left: 6px;

font-size: 12px;

color: #656565;

background: #fff;

border-bottom: 1px dashed #c1c1c1;

}

.mout {

width: 180px;

padding-left: 6px;

border-top: 1px dashed #fff;

border-bottom: 1px solid #fff;

font-size: 12px;

line-height: 160%;

color: #000;

background: #fff;

}

.mover {

width: 180px;

padding-left: 6px;

border-top: #fb6e04 1px solid;

border-bottom: #fb6e04 1px solid;

line-height: 160%;

font-size: 12px;

color: #457007;

background: #fff4d2;

cursor: hand;

}

.selected {

width: 180px;

padding-left: 6px;

border-top: #f2f8ff 1px solid;

border-bottom: #f2f8ff 1px solid;

line-height: 160%;

font-size: 12px;

color: #ffffff;

background: #ff9900;

}

.tdleft {

padding-left: 6px;

font-size: 12px;

}

.tdright {

padding-right: 4px;

}

调用方法

//酒店根据城市查找三字码

function getthreewordbycitysflight(cityname)

{

var threeword = "";

for(var i = 0,len = citysforhotel.length;i

{

if(cityname == citysforhotel[i][2])

{

threeword = citysforhotel[i][1];

break;

}

}

return threeword;

}

function getpidbycity(cityname)

{

var pid = "";

for(var i = 0,len = citysforhotel.length;i

{

if(cityname == citysforhotel[i][2])

{

pid = citysforhotel[i][0];

break;

}

}

return pid;

}

//初始化常用城市

var commoncitys,citys;

var commoncityshotel = new array();

commoncityshotel[0]=new array('3','20','广州','guangzhou','gz');

commoncityshotel[1]=new array('9','27','北京','beijing','bj');

commoncityshotel[2]=new array('12','30','上海','shanghai','sh');

commoncityshotel[3]=new array('3','21','深圳','shenzhen','sz');

commoncityshotel[4]=new array('15','38','天津','tianjin','tj');

commoncityshotel[5]=new array('20','43','杭州','hangzhou','hz');

commoncityshotel[6]=new array('21','44','成都','chengdu','cd');

commoncityshotel[7]=new array('17','40','重庆','chongqing','cq');

commoncityshotel[8]=new array('42','80','西安','xian','xa');

commoncityshotel[9]=new array('27','54','武汉','wuhan','wh');

commoncityshotel[10]=new array('19','42','南京','nanjing','nj');

commoncityshotel[11]=new array('22','83','青岛','qingdao','qd');

commoncityshotel[12]=new array('26','82','三亚','sanya','sy');

commoncitys = commoncityshotel;

var citysforhotel=new array();

citysforhotel[0]=new array('3','20','广州','guangzhou','gz');

citysforhotel[1]=new array('20','424','桐庐','tonglu','tl');

citysforhotel[2]=new array('3','21','深圳','shenzhen','sz');

citysforhotel[3]=new array('25','24','桂林','guilin','gl');

citysforhotel[4]=new array('9','27','北京','beijing','bj');

citysforhotel[5]=new array('12','30','上海','shanghai','sh');

citysforhotel[6]=new array('15','38','天津','tianjin','tj');

citysforhotel[7]=new array('17','40','重庆','chongqing','cq');

citysforhotel[8]=new array('18','41','福州','fuzhou','fz');

citysforhotel[9]=new array('41','423','偃师','yanshi','ys');

citysforhotel[10]=new array('19','42','南京','nanjing','nj');

citysforhotel[11]=new array('20','43','杭州','hangzhou','hz');

citysforhotel[12]=new array('21','44','成都','chengdu','cd');

citysforhotel[13]=new array('22','45','济南','jinan','jn');

citysforhotel[14]=new array('23','46','哈尔滨','harbin','hrb');

citysforhotel[15]=new array('25','51','南宁','nanning','nn');

citysforhotel[16]=new array('26','53','海口','haikou','hk');

citysforhotel[17]=new array('27','54','武汉','wuhan','wh');

citysforhotel[18]=new array('28','55','太原','taiyuan','ty');

citysforhotel[19]=new array('29','56','昆明','kunming','km');

citysforhotel[20]=new array('30','57','南昌','nanchang','nc');

citysforhotel[21]=new array('31','58','西宁','xining','xn');

citysforhotel[22]=new array('32','59','包头','baotou','bt');

citysforhotel[23]=new array('33','60','石家庄','shijiazhuang','sjz');

citysforhotel[24]=new array('3','61','佛山','foshan','fs');

citysforhotel[25]=new array('3','62','珠海', 'zhuhai','zh');

citysforhotel[26]=new array('19','63','无锡','wuxi','wx');

citysforhotel[27]=new array('3','64','河源','heyuan','hy');

citysforhotel[28]=new array('19','65','扬州','yangzhou','yz');

citysforhotel[29]=new array('19','66','常州','changzhou','cz');

citysforhotel[30]=new array('19','67','苏州','suzhou','sz');

citysforhotel[31]=new array('19','68','徐州','xuzhou','xz');

citysforhotel[32]=new array('19','69','南通','nantong','nt');

citysforhotel[33]=new array('3','70','东莞','dongguan','dg');

citysforhotel[34]=new array('3','71','汕头','shantou','st');

citysforhotel[35]=new array('3','73','惠州','huizhou','hz');

citysforhotel[36]=new array('3','74','肇庆','zhaoqing','zq');

citysforhotel[37]=new array('20','419','富阳','fuyang','fy');

citysforhotel[38]=new array('20','420','瑞安','ruian','ra');

citysforhotel[39]=new array('37','78','长沙','changsha','cs');

citysforhotel[40]=new array('41','79','郑州','zhengzhou','zz');

citysforhotel[41]=new array('42','80','西安','xian','xa');

citysforhotel[42]=new array('43','81','沈阳','shenyang','sy');

citysforhotel[43]=new array('26','82','三亚','sanya','sy');

citysforhotel[44]=new array('22','83','青岛','qingdao','qd');

citysforhotel[45]=new array('3','85','中山','zhongshan','zs');

citysforhotel[46]=new array('50','86','拉萨','lasa','ls');

citysforhotel[47]=new array('41','87','洛阳','luoyang','ly');

citysforhotel[48]=new array('33','88','秦皇岛','qinhuangdao','qhd');

citysforhotel[49]=new array('43','89','大连','dalian','dl');

citysforhotel[50]=new array('45','90','长春','changchun','cc');

citysforhotel[51]=new array('45','91','吉林','jilin','jl');

citysforhotel[52]=new array('33','92','唐山','tangshan','ts');

citysforhotel[53]=new array('33','93','邯郸','handan','hd');

citysforhotel[54]=new array('33','94','邢台','xingtai','xt');

citysforhotel[55]=new array('33','95','保定','baoding','bd');

citysforhotel[56]=new array('33','96','张家口','zhangjiakou','zjk');

citysforhotel[57]=new array('33','97','承德','chengde','cd');

citysforhotel[58]=new array('33','98','沧州','cangzhou','cz')

citysforhotel[59]=new array('33','99','廊坊','langfang','lf');

citysforhotel[60]=new array('33','100','衡水','hengshui','hs');

citysforhotel[61]=new array('28','101','大同','datong','dt');

citysforhotel[62]=new array('28','102','阳泉','yangquan','yq');

citysforhotel[63]=new array('28','103','长治','changzhi','cz');

citysforhotel[64]=new array('28','104','晋城','jincheng','jc');

citysforhotel[65]=new array('28','105','朔州','shuozhou','sz');

citysforhotel[66]=new array('28','106','晋中','jinzhong','jz');

citysforhotel[67]=new array('28','107','运城','yincheng','yc');

citysforhotel[68]=new array('28','108','忻州','xinzhou','xz');

citysforhotel[69]=new array('28','109',        '临汾','linfen','lf');

citysforhotel[70]=new array('28','110','吕梁','lvliang','ll');

citysforhotel[71]=new array('32','111','呼和浩特','huhehaote','hhht');

citysforhotel[72]=new array('42','347','商洛','shangluo','sl');

citysforhotel[73]=new array('32','112','乌海','wuhai','wh');

citysforhotel[74]=new array('32','113','赤峰','chifeng','cf');

citysforhotel[75]=new array('32','114','通辽','tongliao','tl');

citysforhotel[76]=new array('32','115','鄂尔多斯','eerduosi','eeds');

citysforhotel[77]=new array('32','116','呼伦贝尔','hulunbeier','hrbe');

citysforhotel[78]=new array('32','117','巴彦淖尔','bayannaoer','byne');

citysforhotel[79]=new array('32','118','乌兰察布','wulanchabu','wlcb');

citysforhotel[80]=new array('32','119','兴安','xingan','xa');

citysforhotel[81]=new array('32','120','锡林郭勒','xilinguole','xlgl');

citysforhotel[82]=new array('32','121','阿拉善','alasan','als');

citysforhotel[83]=new array('43','122','鞍山','anshan','as');

citysforhotel[84]=new array('43','123','抚顺','fushun','fs');

citysforhotel[85]=new array('43','124','本溪','benxi','bx')

citysforhotel[86]=new array('43','125','丹东','dandong','dd');

citysforhotel[87]=new array('43','126','锦州','jinzhou','jz');

citysforhotel[88]=new array('43','127','营口','yingkou','jk');

citysforhotel[89]=new array('43','128','阜新','fuxin','fx');

citysforhotel[90]=new array('43','129','辽阳','liaoyang','ly');

citysforhotel[91]=new array('43','130','盘锦','panjin','pj');

citysforhotel[92]=new array('43','131','铁岭','tieling','tl');

citysforhotel[93]=new array('43','132','朝阳','chaoyang','cy');

citysforhotel[94]=new array('43','133','葫芦岛','huludao','hld');

citysforhotel[95]=new array('45','134','四平','siping','sp');

citysforhotel[96]=new array('45','135','辽源','liaoyuan','ly');

citysforhotel[97]=new array('45','136','通化','tonghua','th');

citysforhotel[98]=new array('45','137','白山','baishan','bs');

citysforhotel[99]=new array('45','138','松原','songyuan','sy');

citysforhotel[100]=new array('45','139','白城','baicheng','bc');

citysforhotel[101]=new array('45','140','延边','yanbian','yb');

citysforhotel[102]=new array('23','141','齐齐哈尔','qiqihaer','jjhe');

citysforhotel[103]=new array('23','142','鸡西','jixi','jx');

citysforhotel[104]=new array('23','143','鹤岗','hegang','hg');

citysforhotel[105]=new array('23','144','双鸭山','shuangyashan','sys');

citysforhotel[106]=new array('23','145','大庆','daqing','dq');

citysforhotel[107]=new array('23','146','伊春','yichun','yc');

citysforhotel[108]=new array('23','147','佳木斯','yiamusi','jms');

citysforhotel[109]=new array('23','148','七台河','qitaihe','qth');

citysforhotel[110]=new array('23','149','牡丹江','mudanjiang','mtj');

citysforhotel[111]=new array('23','150','黑河','heihe','hh');

citysforhotel[112]=new array('23','151','绥化','suihua','dh');

citysforhotel[113]=new array('23','152','大兴安岭','daxinganling','dxal');

citysforhotel[114]=new array('19','153','连云港','lianyungang','lyg');

citysforhotel[115]=new array('19','154','淮安','huaian','ha');

citysforhotel[116]=new array('19','155','镇江','zhenjiang','zj');

citysforhotel[117]=new array('19','156','泰州','taizhou','tz');

citysforhotel[118]=new array('19','157','盐城','yancheng','yc');

citysforhotel[119]=new array('19','158','宿迁','suqian','sq');

citysforhotel[120]=new array('20','159','宁波','ningbo','nb');

citysforhotel[121]=new array('20','160','温州','wenzhou','wz');

citysforhotel[122]=new array('20','161','嘉兴','jiaxing','jx');

citysforhotel[123]=new array('20','162','湖州','huzhou','hz');

citysforhotel[124]=new array('20','163','绍兴','shaoxing','sx');

citysforhotel[125]=new array('20','164','金华','jinhua','jh');

citysforhotel[126]=new array('20','165','衢州','quzhou','qz');

citysforhotel[127]=new array('20','166','舟山','zhoushan','zs');

citysforhotel[128]=new array('20','167','台州','taizhou','tz');

citysforhotel[129]=new array('20','168','丽水','lishui','ls');

citysforhotel[130]=new array('44','169','合肥','hefei','hf');

citysforhotel[131]=new array('44','170','芜湖','wuhu','fw');

citysforhotel[132]=new array('44','171','蚌埠','bengbu','bf');

citysforhotel[133]=new array('51','422','南投','nantou','nt');

citysforhotel[134]=new array('44','172','淮南','huainan','hn');

citysforhotel[135]=new array('44','173','马鞍山','maanshan','mas');

citysforhotel[136]=new array('44','174','淮北','huaibei','hb');

citysforhotel[137]=new array('44','175','铜陵','tongling','tl');

citysforhotel[138]=new array('44','176','安庆','anqing','aq');

citysforhotel[139]=new array('44','177','黄山','huangshan','hs');

citysforhotel[140]=new array('44','178','滁州','chuzhou','cz');

citysforhotel[141]=new array('44','179','阜阳','fuyang','fy');

citysforhotel[142]=new array('44','180','宿州','suzhou','sz');

citysforhotel[143]=new array('44','181','巢湖','caohu','ch');

citysforhotel[144]=new array('44','182','六安','liuan','la');

citysforhotel[145]=new array('44','183','亳州','haozhou','hz');

citysforhotel[146]=new array('44','184','池州','chizhou','cz');

citysforhotel[147]=new array('44','185','宣城','xuancheng','xc');

citysforhotel[148]=new array('18','186','厦门','xiamen','xm');

citysforhotel[149]=new array('18','187','莆田','putian','pt');

citysforhotel[150]=new array('18','188','三明','sanming','sm');

citysforhotel[151]=new array('18','189','泉州','quanzhou','qz');

citysforhotel[152]=new array('18','190','漳州','zhangzhou','zz');

citysforhotel[153]=new array('18','191','南平','nanping','np');

citysforhotel[154]=new array('18','192','龙岩','longyan','ly');

citysforhotel[155]=new array('18','193','宁德','ningde','nd');

citysforhotel[156]=new array('30','194','景德镇','jingdezhen','jdz');

citysforhotel[157]=new array('30','195','萍乡','pingxiang','px');

citysforhotel[158]=new array('30','196','九江','jiujiang','jj');

citysforhotel[159]=new array('30','197','新余','xinyu','xy');

citysforhotel[160]=new array('30','198','鹰潭','yingtan','yt');

citysforhotel[161]=new array('30','199','赣州','ganzhou','gz');

citysforhotel[162]=new array('30','200','吉安','jian','ja');

citysforhotel[163]=new array('30','201','宜春','yichun','yc');

citysforhotel[164]=new array('30','202','抚州','fuzhou','fz');

citysforhotel[165]=new array('30','203','上饶','shangrao','sr');

citysforhotel[166]=new array('22','204','淄博','zibo','zb');

citysforhotel[167]=new array('22','205','枣庄','zaozhuang','zz');

citysforhotel[168]=new array('22','206','东营','dongying','dy');

citysforhotel[169]=new array('22','207','烟台','yantai', 'yt');

citysforhotel[170]=new array('22','208','潍坊','weifang','wf');

citysforhotel[171]=new array('22','209','威海','weihai','wh');

citysforhotel[172]=new array('22','210','济宁','jining','jn');

citysforhotel[173]=new array('22','211','泰安','taian','ta');

citysforhotel[174]=new array('22','212','日照','rizhao','rz');

citysforhotel[175]=new array('22','213','莱芜','laifu','lf');

citysforhotel[176]=new array('22','214','临沂','linyi','ly');

citysforhotel[177]=new array('22','215','德州','dezhou','dz');

citysforhotel[178]=new array('22','216','聊城','liaocheng','lc');

citysforhotel[179]=new array('22','217','滨州','binzhou','bz');

citysforhotel[180]=new array('22','218','菏泽','heze','hz');

citysforhotel[181]=new array('41','219','开封','kaifeng','kf');

citysforhotel[182]=new array('41','220','平顶山','pingdingshan','pds');

citysforhotel[183]=new array('41','221','焦作','jiaozuo','jz');

citysforhotel[184]=new array('41','222','鹤壁','hebi','hb');

citysforhotel[185]=new array('41','223','新乡','xinxiang','xx');

citysforhotel[186]=new array('41','224','安阳','anyang','ay');

citysforhotel[187]=new array('41','225','濮阳','puyang','py');

citysforhotel[188]=new array('41','226','许昌','xuchang','xc');

citysforhotel[189]=new array('41','227','漯河','luohe','lh');

citysforhotel[190]=new array('41','228','三门峡','sanmenxia','smj');

citysforhotel[191]=new array('41','229','南阳','nanyang','ny');

citysforhotel[192]=new array('41','230','商丘','shangqiu','sq');

citysforhotel[193]=new array('41','231','信阳','xinyang','xy');

citysforhotel[194]=new array('41','232','周口','zhoukou','zk');

citysforhotel[195]=new array('41','233','驻马店','zhumadian','zmd');

citysforhotel[196]=new array('41','234','济源','jiyuan','jy');

citysforhotel[197]=new array('27','235','黄石','huangshi','hs');

citysforhotel[198]=new array('27','236','襄樊','xiangfan','xf');

citysforhotel[199]=new array('27','237','十堰','shiyan','sy');

citysforhotel[200]=new array('27','238','荆州','jingzhou','jz');

citysforhotel[201]=new array('27','239','宜昌','yichang','yc');

citysforhotel[202]=new array('27','240','荆门','jingmen','jm');

citysforhotel[203]=new array('27','241','鄂州','ezhou','ez');

citysforhotel[204]=new array('27','242','孝感','xiaogan','xg');

citysforhotel[205]=new array('27','243','黄冈','huanggang','hg');

citysforhotel[206]=new array('27','244','咸宁','xianning','xn');

citysforhotel[207]=new array('27','245','随州','suizhou','sz');

citysforhotel[208]=new array('27','246','恩施','enshi','es');

citysforhotel[209]=new array('37','247','株洲','zhuzhou','zz');

citys = citysforhotel;

//根据三字码查找城市

function getcitybythreeword(threeword)

{

var citycn = "";

for(var i = 0,len = citys.length;i

{

if(threeword == citys[i][1])

{

citycn = citys[i][2];

break;

}

}

return citycn;

}

//根据城市查找三字码

function getthreewordbycity(cityname)

{

var threeword = "";

for(var i = 0,len = citys.length;i

{

if(cityname == citys[i][2])

{

threeword = citys[i][1];

break;

}

}

return threeword;

}

function getpidbycity(cityname)

{

var pid = "";

for(var i = 0,len = citys.length;i

{

if(cityname == citys[i][2])

{

pid = citys[i][0];

break;

}

}

return pid;

}

function showsearch(obj,type){

if(type){

if(obj.value==""){

obj.style.color="#c1c1c1";

obj.value="中文/拼音";

}

}else{

if(obj.value=="中文/拼音"){

obj.style.color="#000000";

obj.value="";

}

}

}

var parentbject;

window.city_suggest = function(){

this.remoreurl = ''; // 远程url地址

this.object = '';

this.id2 = '';

this.taskid = 0;

this.delaysec = 100; // 默认延迟多少毫秒出现提示框

this.lastkeys_val = 0;

this.lastinputstr = '';

/* 2009-03-17 start : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

this.nextobject='';

/* 2009-03-17 end : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

/**

* 初始化类库

*/

this.init_zhaobussuggest=  function(){

var objbody = document.getelementsbytagname("body").item(0);

var objiframe = document.createelement("iframe");

var objplatform = document.createelement("div");

objiframe.setattribute('id','getiframe');

objiframe.style.zindex='100';

objiframe.style.position = 'absolute';

objiframe.style.display = 'none';

objplatform.setattribute('id','getplatform');

objplatform.setattribute('align','left');

objbody.appendchild(objiframe);

objiframe.ownerdocument.body.appendchild(objplatform);

if(!document.all) {

window.document.addeventlistener("click",this.hidden_suggest,false);

}else{

window.document.attachevent("onclick",this.hidden_suggest);

}

}

/***************************************************fill_div()*********************************************/

//函数功能:动态填充div的内容,该div显示所有的提示内容

//函数参数:allplat 一个字符串数组,包含了所有可能的提示内容

this.fill_div = function(allplat){

var msgplat = '';

var all = '';

var spell = '';

var chinese = '';

var platkeys = this.object.value;

platkeys=this.ltrim(platkeys);

if(!platkeys){

msgplat += '输入中文/拼音或↑↓选择';

for(i=0;i

all=allplat[i].split(",");

spell=all[0];

chinese=all[1];

szm=all[2];

msgplat += ''+ spell +

'' + chinese + '' + szm + '';

}

}

else {

if(allplat.length < 1 || !allplat[0]){

msgplat += '对不起,找不到:'+platkeys+'';

}

else{

msgplat += ''+platkeys+',按拼音排序';

for(i=0;i

all=allplat[i].split(",");

spell=all[0];

chinese=all[1];

szm=all[2];

msgplat += ''+ spell +

'' + chinese + '' + szm + '';

}

}

}

document.getelementbyid("getplatform").innerhtml =  msgplat;

var nodes = document.getelementbyid("getplatform").childnodes;

nodes[0].classname = "hint";

if(allplat.length >= 1 && allplat[0]){

nodes[2].classname = "selected";

}

this.lastkeys_val = 0;

for(var i=2;i

nodes[i].onmouseo教程ver = function(){

this.classname = "mover";

}

nodes[i].onmouseout = function(){

if(parentbject.lastkeys_val==(parentindexof(this)-2)){this.classname = "selected";}

else{this.classname = "mout";}

}

}

document.getelementbyid("getiframe").style.width = document.getelementbyid("getplatform").clientwidth+50;

document.getelementbyid("getiframe").style.height = document.getelementbyid("getplatform").clientheight+50;

}

/***************************************************fix_div_coordinate*********************************************/

//函数功能:控制提示div的位置,使之刚好出现在文本输入框的下面

this.fix_div_coordinate = function(){

var leftpos=0;

var toppos=0;

atag = this.object;

do {

atag = atag.offsetparent;

leftpos        += atag.offsetleft;

toppos += atag.offsettop;

}while(atag.tagname!="body");

document.getelementbyid("getiframe").style.width = this.object.offsetwidth + 'px';

if(document.layers){

document.getelementbyid("getiframe").style.left = this.object.offsetleft        + leftpos + "px";

document.getelementbyid("getiframe").style.top = this.object.offsettop +        toppos + this.object.offsetheight + 2 + "px";

}else{

document.getelementbyid("getiframe").style.left =this.object.offsetleft        + leftpos  +"px";

document.getelementbyid("getiframe").style.top = this.object.offsettop +        toppos + this.object.offsetheight + 'px';

}

document.getelementbyid("getplatform").style.width = this.object.offsetwidth + 'px';

if(document.layers){

document.getelementbyid("getplatform").style.left = this.object.offsetleft        + leftpos + "px";

document.getelementbyid("getplatform").style.top = this.object.offsettop +        toppos + this.object.offsetheight + 2 + "px";

}else{

document.getelementbyid("getplatform").style.left =this.object.offsetleft        + leftpos  +"px";

document.getelementbyid("getplatform").style.top = this.object.offsettop +        toppos + this.object.offsetheight + 'px';

}

}

/***************************************************hidden_suggest*********************************************/

//函数功能:隐藏提示框

this.hidden_suggest = function (){

this.lastkeys_val = 0;

document.getelementbyid("getiframe").style.visibility = "hidden";

document.getelementbyid("getplatform").style.visibility = "hidden";

}

/***************************************************show_suggest*********************************************/

//函数功能:显示提示框

this.show_suggest = function (){

document.getelementbyid("getiframe").style.visibility = "visible";

document.getelementbyid("getplatform").style.visibility = "visible";

}

this.is_showsuggest= function (){

if(document.getelementbyid("getplatform").style.visibility == "visible") return true;else return false;

}

this.sleep = function(n){

var start=new date().gettime(); //for opera only

while(true) if(new date().gettime()-start>n) break;

}

this.ltrim = function (strtext){

return strtext.replace(/[[        discuz_code_11        ]amp;|^*%#@! ]+/, '');

}

/***************************************************add_input_text*********************************************/

//函数功能:当用户选中时填充相应的城市名字

this.add_input_text = function (keys,szm,flag){

keys=this.ltrim(keys)

this.object.value = keys;

var id=this.object.id;

var id2 = this.id2;

if(document.id2){

document.getelementbyid(this.id2).value = szm;

}

document.getelementbyid(id).style.color="#000000";

document.getelementbyid(id).value=keys;

/* 2009-03-17 start : 当用户用鼠标点击下拉选择框,选择后,光标跳转到下一个输入框。*/

if(flag!=undefined&&flag!=null&&flag!='') this.focusnext();

/* 2009-03-17 end : 当用户用鼠标点击下拉选择框,选择后,光标跳转到下一个输入框。*/

}

/***************************************************keys_handleup*********************************************/

//函数功能:用于处理当用户用向上的方向键选择内容时的事件

this.keys_handleup = function (){

if(this.lastkeys_val > 0) this.lastkeys_val--;

var nodes = document.getelementbyid("getplatform").childnodes;

if(this.lastkeys_val < 0) this.lastkeys_val = nodes.length-1;

var b = 0;

for(var i=2;i

if(b == this.lastkeys_val){

nodes[i].classname = "selected";

this.add_input_text(nodes[i].childnodes[0].childnodes[0].childnodes[1].innerhtml,nodes[i].childnodes[0].childnodes[0].childnodes[2].innerhtml);

}else{

nodes[i].classname = "mout";

}

b++;

}

}

/***************************************************keys_handledown*********************************************/

//函数功能:用于处理当用户用向下的方向键选择内容时的事件

this.keys_handledown = function (){

this.lastkeys_val++;

var nodes = document.getelementbyid("getplatform").childnodes;

if(this.lastkeys_val >= nodes.length-2) {

this.lastkeys_val--;

return;

}

var b = 0;

for(var i=2;i

if(b == this.lastkeys_val){

nodes[i].classname = "selected";

this.add_input_text(nodes[i].childnodes[1].childnodes[1].childnodes[2].innerhtml,nodes[i].childnodes[1].childnodes[1].childnodes[3].innerhtml);

}else{

nodes[i].classname = "mout";

}

b++;

}

}

this.ajaxac_getkeycode = function (e)

{

var code;

if (!e) var e = window.event;

if (e.keycode) code = e.keycode;

else if (e.which) code = e.which;

return code;

}

/***************************************************keys_enter*********************************************/

//函数功能:用于处理当用户回车键选择内容时的事件

this.keys_enter = function (){

var nodes = document.getelementbyid("getplatform").childnodes;

for(var i=2;i

if(nodes[i].classname == "selected"){

this.add_input_text(nodes[i].childnodes[0].childnodes[0].childnodes[1].innerhtml,nodes[i].childnodes[0].childnodes[0].childnodes[2].innerhtml);

}

}

this.hidden_suggest();

/* start : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

this.focusnext();

/*  end : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

}

/*  start : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

this.focusnext=function()

{

if(this.nextobject!=undefined&&this.nextobject!=null)

{

this.nextobject.focus();

this.nextobject.click();

}

}

/* 2009-03-17 end : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

/***************************************************display*********************************************/

//函数功能:入口函数,将提示层div显示出来

//输入参数:object 当前输入所在的对象,如文本框

//输入参数:e ie事件对象

this.display = function (object,id2,e,objectex){

/* 2009-03-12 start : 第二次触发城市控件,默认全选。*/

var content = object.value;

var flag = getthreewordbycity(content)

if(flag!="")

{

object.focus();

object.select();

}//end if

/* 2009-03-12 end*/

/* 2009-03-17 start : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

this.nextobject=(objectex!=undefined&&objectex!=null)?objectex:null;

/* 2009-03-17 end : 当用户在下拉选择框选择后,使用回车键,光标跳转到下一个输入框。*/

this.id2 = id2;

if(!document.getelementbyid("getplatform")) this.init_zhaobussuggest();

if (!e) e = window.event;

e.stoppropagation;

e.cancelbubble = true;

if (e.target) targ = e.target;  else if (e.srcelement) targ = e.srcelement;

if (targ.nodetype == 3)  targ = targ.parentnode;

var inputkeys = this.ajaxac_getkeycode(e);

switch(inputkeys){

case 38: //向上方向键

this.keys_handleup(object.id);

&n

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
int server_socket_init(){ int server_sockfd; struct sockaddr_in server_address; server_sockfd = socket(AF_INET, SOCK_STREAM, 0);//建立服务器端socket if(server_sockfd < 0 ) return -1; bzero(&server_address,sizeof(server_address)); server_address.sin_family = AF_INET; //server_address.sin_addr.s_addr = htonl(INADDR_ANY); //本机 server_address.sin_addr.s_addr = inet_addr(SERVER_IP); server_address.sin_port = htons(SERVER_PORT); if(bind(server_sockfd, (struct sockaddr *)&server_address,sizeof(server_address)) < 0 ) { close(server_sockfd); return -1; } if(listen(server_sockfd, 5) < 0) { close(server_sockfd); return -1; } return server_sockfd; } int server_Listening(int server_sockfd) { struct sockaddr_in client_address; int client_sockfd, ret = 0; int select_result,fd,client_len,data_size; struct timeval timeout; fd_set readfds, testfds; FD_ZERO(&readfds); FD_SET(server_sockfd, &readfds); while(1) { //每一轮监听后结构体被清0,每监听完一轮就要对结构体重新赋值,指定监听对象 testfds = readfds; timeout.tv_sec = 2; timeout.tv_usec = 500000; select_result = select(FD_SETSIZE, &testfds,NULL,NULL,NULL); if (select_result < 0) { return -1; } //perr_exit("select error"); for(fd = 0; fd < FD_SETSIZE; fd++) /*扫描所有的socket(文件)描述符*/ { if(FD_ISSET(fd,&testfds))/*找到可以读相关socket(文件)描述符*/ { if(fd == server_sockfd) //为服务器socket,是则表示为客户请求连接。 { client_len = sizeof(client_address); client_sockfd = accept(server_sockfd,(struct sockaddr *)&client_address,&client_len); if(client_sockfd < 0) return -1; FD_SET(client_sockfd, &readfds);//将客户端socket加入到集合中 } else //客户端socket中有数据请求时 { ioctl(fd, FIONREAD, &data_size);//nread得到fd缓冲区的大小,就是当client入缓冲区,这操作是读取缓冲区的大小 // n=read(fd,buf,sizeof(buf));//n即和nread一致 /*客户数据请求完毕,关闭套接字,从集合中清除相应描述符 */ if(data_size == 0) { //test FASTCGI_LOG("\n client_close_remore :%d\n\n\n\n",fd); close(fd); FD_CLR(fd, &readfds); } else if(!PerformServerTransfer(fd)){ return -1; } } } } } }这个是tcp server端有误么
07-12
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值