注册 登录
编程论坛 jQuery论坛

表单提交后得不到值

swalia 发布于 2007-05-21 00:54, 2192 次点击

只有本站会员才能查看附件,请 登录

dt1.js里面的代码是:
var oPopup = window.createPopup();
var tr01_01 = "#E7E3E7"; //第一行背景颜色
var tr01_02 = "#D6D3D6"; //第二行背景颜色
var tr01_03 = "#FFFFFF";
var tab01 = "#6595D6"; //边框颜色
var kongj;
var style1 = 'style="font-weight: bold;color: #FFFFFF;background-image: url(/B2C/common/images/newimg/bg1.gif);height: 25px;font-size: 9pt;"';
var style2 = 'style="BACKGROUND-IMAGE: url(../images/newimg/bg2.gif); BACKGROUND-COLOR: #F3F6FA; color: #333333;background-repeat:repeat-x; background-position:bottom; font-size: 9pt;"';
var style3 = 'style="position: relative; left: 0px; top: 0px; width: 100%;overflow:hidden; text-overflow:ellipsis;"';

//北京|PEK|B 城市|三字代码|拼音首字母
var shcs = new Array("北京|PEK|B","上海|SHA|S","天津|TSN|T","重庆|CKG|C","太原|TYN|T","呼和浩特|HET|H","沈阳|SHE|S","长春|CGQ|C","哈尔滨|HRB|H","南京|NKG|N","杭州|HGH|H","合肥|HFE|H","福州|FOC|F","南昌|KHN|N","济南|TNA|J","郑州|CGO|Z","武汉|WUH|W","长沙|CSX|C","广州|CAN|G","南宁|NNG|N","海口|HAK|H","成都|CTU|C","贵阳|KWE|G","昆明|KMG|K","西安|SIA|X","兰州|LHW|L","银川|INC|Y","西宁|XNN|X","乌鲁木齐|URC|W","石家庄|SJW|S","拉萨|LXA|L");
var qtcs = new Array("阿勒泰|AAT|A","安庆|AQG|A","阿克苏|AKU|A","安康|AKA|A","鞍山|IOB|A","保山|BSD|B","包头|BAV|B","北海|BHY|B","北京|PEK|B","长沙|CSX|C","长春|CGQ|C","常德|CGD|C","长治|CIH|C","常州|CZX|C","昌都|BPX|C","朝阳|CHG|C","成都|CTU|C","赤峰|CIF|C","重庆|CKG|C","敦煌|DNH|D","大理|DLU|D","大连|DLC|D","大同|DAT|D","丹东|DDG|D","达县|DAX|D","德宏芒市|LUM|D","迪庆香格里拉|DIG|D","东营|DOY|D","恩施|ENH|E","阜阳|FUG|F","福州|FOC|F","赣州|KOW|G","格尔木|GOQ|G","广元|GYS|G","广州|CAN|G","广汉|GHN|G","桂林|KWL|G","贵阳|KWE|G","怀化|HJJ|H","哈尔滨|HRB|H","海口|HAK|H","海拉尔|HLD|H","哈密|HMI|H","汉中|HZG|H","杭州|HGH|H","合肥|HFE|H","衡阳|HNY|H","和田|HTN|H","呼和浩特|HET|H","黄山|TXN|H","黄岩|HYN|H","惠阳|AHE|H","吉林|JIL|J","济南|TNA|J","吉安|KNC|J","锦州|JNZ|J","景德镇|JDZ|J","荆州、沙市|SHS|J","九江|JIU|J","九寨沟|JZH|J","佳木斯|JMU|J","库尔勒|KRL|K","库车|KCA|K","喀什|KHG|K","克拉玛依|KRY|K","昆明|KMG|K","拉萨|LXA|L","兰州|LHW|L","连云港|LYG|L","梁平|LIA|L","临沂|LYI|L","临沧|LNJ|L","柳州|LZH|L","泸州|LZO|L","洛阳|LYA|L","满州里|NZH|M","梅县|MXZ|M","绵阳|MIG|M","牡丹江|MDG|M","南京|NKG|N","南昌|KHN|N","南充|NAO|N","南宁|NNG|N","南通|NTG|N","南阳|NNY|N","宁波|NGB|N","齐齐哈尔|NDG|Q","且末|IQM|Q","秦皇岛|SHP|Q","青岛|TAO|Q","庆阳|IQN|Q","衢州|JUZ|Q","泉州晋江|JJN|Q","三亚|SYX|S","汕头|SWA|S","上海|SHA|S","鄯善|SXJ|S","韶关|SHG|S","沈阳|SHE|S","深圳|SZX|S","石家庄|SJW|S","思茅|SYM|S","塔城|TCG|T","太原|TYN|T","天津|TSN|T","铜仁|TEN|T","万州|WXN|W","潍坊|WEF|W","威海|WEH|W","温州|WNZ|W","武汉|WUH|W","乌鲁木齐|URC|W","武夷山|WUS|W","无锡|WUX|W","梧州|WUZ|W","文山壮族苗族自治州|WNH|W","锡林浩特|XIL|X","西安|SIA|X","西宁|XNN|X","西双版纳景洪|JHG|X","厦门|XMN|X","襄樊|XFN|X","西昌|XIC|X","兴义|ACX|X","徐州|XUZ|X","盐城|YNZ|Y","宜昌|YIH|Y","银川|INC|Y","永州|LLF|Y","延吉|YNJ|Y","烟台|YNT|Y","延安|ENY|Y","宜宾|YBP|Y","义乌|YIW|Y","伊宁|YIN|Y","榆林|UYN|Y","湛江|ZHA|Z","张家界|DYG|Z","昭通|ZAT|Z","郑州|CGO|Z","舟山|HSN|Z","珠海|ZUH|Z","遵义|ZYI|Z","丽江|LJG|L");
var ywzm = new Array("A","B","C","D","E","F","G","H","J","K","L","M","N","Q","S","T","W","X","Y","Z")
var popup_gd=25; //数据显示高度
var popup_i;
var popup_int0=0;
var popup_int1=0;
var popup_int2=0;
var popup_int3=0;


function Split(popup_str,popup_n,popup_s){ //字符串,取第几个数据,分割字符
var popup_split=popup_str.split(popup_s);
return popup_split[popup_n];
}

function popUp(abc){
if(typeof(abc)=='string')
kongj=document.all(abc);
else
kongj=abc;

var posLib = {
getClientLeft:function (el) {
var r = el.getBoundingClientRect();
return r.left - this.getBorderLeftWidth(this.getCanvasElement(el));
},

getClientTop: function (el) {
var r = el.getBoundingClientRect();
return r.top - this.getBorderTopWidth(this.getCanvasElement(el));
},

getLeft: function (el) {
return this.getClientLeft(el) + this.getCanvasElement(el).scrollLeft;
},

getTop: function (el) {
return this.getClientTop(el) + this.getCanvasElement(el).scrollTop;
},

getInnerLeft: function (el) {
return this.getLeft(el) + this.getBorderLeftWidth(el);
},

getInnerTop: function (el) {
return this.getTop(el) + this.getBorderTopWidth(el);
},

getWidth: function (el) {
return el.offsetWidth;
},

getHeight: function (el) {
return el.offsetHeight;
},

getCanvasElement: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
if (doc.compatMode == "CSS1Compat")
return doc.documentElement;
else
return doc.body;
},

getBorderLeftWidth: function (el) {
return el.clientLeft;
},

getBorderTopWidth: function (el) {
return el.clientTop;
},

getScreenLeft: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenLeft + this.getBorderLeftWidth(this.getCanvasElement(el)) + this.getClientLeft(el);
},

getScreenTop: function (el) {
var doc = el.ownerDocument || el.document; // IE55 bug
var w = doc.parentWindow;
return w.screenTop + this.getClientTop(el);//+ this.getBorderTopWidth(this.getCanvasElement(el))
}
}

popup_int0=0;
popup_int1=0;
popup_int2=0;
popup_int3=0;
var tab;
tab = '<table width="350" border="0" cellpadding="0" cellspacing="2" bgcolor="' +tab01+ '">';
tab+= '<tr>';
tab+= '<td>';
tab+= '<table width="100%" border="0" cellpadding="0" cellspacing="0" style="background-color:' +tr01_02+ ';">';
tab+= ' <tr align="center">';
tab+= ' <td height="23"'+style1+'>请选择您要的城市</td>';
tab+= ' </tr>';
tab+= ' <tr align="center">';
tab+= ' <td height="23"'+style2+'>';
tab+= ' <table width="100%" align="center" border="0" cellspacing="0" cellpadding="0" style="font-size: 9pt"><tr><td width="100">城市拼音首字母:</td><td><table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size: 10pt"><tr align="center">';
for(var ywzm_i=0;ywzm_i<26;ywzm_i++){
if(!ywzm[ywzm_i])break;
tab+= '<td id=H_"'+ywzm[ywzm_i]+'"><label id="'+ywzm[ywzm_i]+'" style="color:#0000FF; cursor:hand" title="点击查看城市首字母为 '+ywzm[ywzm_i]+' 的城市">'+ywzm[ywzm_i]+'</label></td>';
}
tab+= ' <td id="H_SH"><label id="SH" style="color:#FF0000; cursor:hand" title="点击查看省会城市">SH</label></td>';
tab+= ' </tr></table></td></tr></table>';
tab+= ' </td>';
tab+= ' </tr>';
tab+= ' <tr align="center">';
tab+= ' <td id="Popup_Tab">';
tab+= ' <table width="100%" border="0" cellspacing="1" cellpadding="0" style="font-size: 9pt">';

for(popup_i=0;popup_i<36;popup_i++){
if(popup_i==0 || popup_i % 6 ==0){
tab+= ' <tr align="center" style="background-color:' +tr01_03+ ';">';
}
if(shcs[popup_i]){
tab+= ' <td height="'+popup_gd+'" width="14.3%" ID="popup_td_cszm_'+popup_int0+'" title="'+Split(shcs[popup_i],0,"|")+'" style="font-size: 9pt"><NOBR '+style3+' ID="popup_NOBR_cszm_'+Split(shcs[popup_i],1,"|")+'_'+popup_int0+'">'+Split(shcs[popup_i],0,"|")+'</NOBR></td>';
popup_int0++;
}else{
tab+= ' <td height="'+popup_gd+'" width="14.3%">&nbsp;</td>';
}
popup_int3 = popup_i+1;
if(popup_int3 % 6 ==0){
tab+= ' </tr>';
}
}

tab+= ' </table>';
tab+= ' </td>';
tab+= ' </tr>';
tab+= '</table>';
tab+= '</td>';
tab+= '</tr>';
tab+= '</table>';

var newX = posLib.getClientLeft(kongj) + posLib.getCanvasElement(kongj).clientLeft;
var newY = posLib.getClientTop(kongj) + kongj.offsetHeight + posLib.getCanvasElement(kongj).clientTop;
oPopup.document.body.innerHTML = tab;
oPopup.document.body.onclick = Htc_OnClick;
oPopup.document.body.onmousemove = Htc_onmousemove;
oPopup.show(newX,newY,350,209,document.body);
}

function Htc_OnClick(){ //鼠标点击事件
var Htc_str;
var obj=this.document.parentWindow;
var e = obj.event.srcElement;
if (e.tagName == "LABEL") {
if(e.id!=""){
yc_dt(e.id);
}
}
if (e.tagName == "NOBR") {
//f_z(Split(e.id,3,"_"));
f_z(oPopup.document.all(e.id).innerHTML);
oPopup.hide();
}

if (e.tagName == "TD"){//H_
if(e.id!=""){
yc_dt(Split(e.id,1,"_"));
}
}
}

var ll="popup_td_cszm_0";
function Htc_onmousemove(){ //鼠标移动事件
var obj=this.document.parentWindow;
var e = obj.event.srcElement;
if (e.tagName == "TD") {
if(e.id!=""){turnrowcolor(e.id,ll);}
}
if (e.tagName == "NOBR") {
if(e.id!=""){turnrowcolor("popup_td_cszm_"+Split(e.id,4,"_"),ll);}
}
}

function turnrowcolor(ss,ls){ //鼠标移动TD背景颜色
var bc="#FFD373";
if(oPopup.document.all(ls))oPopup.document.all(ls).style.backgroundColor="";
if(oPopup.document.all(ss))oPopup.document.all(ss).style.backgroundColor=bc;
if(oPopup.document.all(ss))oPopup.document.all(ss).style.cursor="hand";
ll=ss;
}

//var yc_dt_cs="SH";
function yc_dt(int){
var yc_dt_cs="SH";
if(int!=yc_dt_cs){
oPopup.document.all(yc_dt_cs).style.color="#0000FF";
oPopup.document.all(int).style.color="#FF0000";
yc_dt_cs=int;
if(int!="SH"){
Popup_tab(int,0);
}else{
Popup_tab(int,1);
}
}
}

function Popup_tab(str,lx){ //生成数据
var Popup_dat_i=0;
var Popup_dat_n;
var Popup_dat_tab="";
var Popup_dat =new Array()
if(lx==0){
for(Popup_dat_n=0;Popup_dat_n<qtcs.length;Popup_dat_n++){
if(Split(qtcs[Popup_dat_n],2,"|")==str){
Popup_dat[Popup_dat_i++]=qtcs[Popup_dat_n];
}
}
}else{
Popup_dat=shcs;
}
popup_int0=0;

Popup_dat_tab+= '<table width="100%" border="0" cellspacing="1" cellpadding="0" style="font-size: 9pt">';
for(Popup_dat_n=0;Popup_dat_n<36;Popup_dat_n++){
if(Popup_dat_n==0 || Popup_dat_n % 6 ==0){
Popup_dat_tab+= ' <tr align="center" style="background-color:' +tr01_03+ ';">';
}
if(Popup_dat[Popup_dat_n]){
Popup_dat_tab+= ' <td height="'+popup_gd+'" width="14.3%" ID="popup_td_cszm_'+popup_int0+'" title="'+Split(Popup_dat[Popup_dat_n],0,"|")+'" style="font-size: 9pt"><NOBR '+style3+' ID="popup_NOBR_cszm_'+Split(Popup_dat[Popup_dat_n],1,"|")+'_'+popup_int0+'">'+Split(Popup_dat[Popup_dat_n],0,"|")+'</NOBR></td>';
popup_int0++;
}else{
Popup_dat_tab+= ' <td height="'+popup_gd+'" width="14.3%">&nbsp;</td>';
}
popup_int3 = Popup_dat_n+1;
if(popup_int3 % 6 ==0){
Popup_dat_tab+= ' </tr>';
}
}
Popup_dat_tab+= ' </table>';
oPopup.document.all("Popup_Tab").innerHTML=Popup_dat_tab;
}

function f_z(temp){ //赋值给控件
kongj.value=temp;
setCodevalue(temp);
}
function setCodevalue(temp){
var length=qtcs.length;

for(i=0;i<length;i++){
var tempArray=qtcs[i].split("|");
if(tempArray[0]==temp){
kongj.codevalue=tempArray[1];
break;
}
}
}
这个是城市控件.怎么样能够选择中文后得到的值是中文边的三个字母呢????
<SCRIPT language=javascript src="dt1.js"></SCRIPT>
<form name="form1" method="post" action="22.asp">

<INPUT name="Input" id=city1
style="FONT-SIZE: 12px; WIDTH: 100px" onblur=checkCityName(this);
onclick="popUp('city1')" value="广州"
codevalue="">
<input type="hidden" name="imginfo" id="imginfo" >

<input type="submit" name="Submit" value="提交">
</form>
就是提交后imginfo表单里面的值是Value = codevalue里面的值
代码应该怎么写啊

3 回复
#2
lmhllr2007-05-21 12:49
哦,我晕!这么多代码谁看啊。。。

#3
發呆的小猪2007-06-11 09:32

没太明白LZ的意思,说详细一点,大家帮你分析一下

#4
swalia2007-06-26 03:45
發呆的小猪版主:我在源文件里面有代码,帮我看看!谢谢您
1