| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 861 人关注过本帖
标题:如何用JavaScript得到这个值?
只看楼主 加入收藏
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
 问题点数:0 回复次数:5 
如何用JavaScript得到这个值?
<INPUT id=city1 onblur=checkCityName(this);
style="FONT-SIZE: 12px; WIDTH: 100px"
onclick="popUp('city1')" value=广州
name=Startcity01 codevalue="CAN">
在表单提交时,我想要得到codevalue="CAN"中的"CAN"应该怎么样用JavaScript去实像呢?

正常提交得到的是"广州"但是我需要的是"CAN"这个数据应该怎么实现,求助急用
搜索更多相关主题的帖子: JavaScript 广州 CAN codevalue name 
2007-04-15 00:30
lmhllr
Rank: 8Rank: 8
等 级:贵宾
威 望:44
帖 子:1504
专家分:42
注 册:2005-5-12
收藏
得分:0 

还没弄明白啊,那写个简单的,只是提供思路


<INPUT id=\"city1\" value=广州 name=Startcity01 codevalue=\"CAN\">
<script language=\"javascript\">
var codeValue = document.getElementById(\"city1\").codevalue;
alert(codeValue);
</script>

2007-04-15 18:26
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
得分:0 
<INPUT id="city1" value=广州 name=Startcity01 codevalue="CAN">
<script language="javascript">
var codeValue = document.getElementById("city1").codevalue;
alert(codeValue);
</script>
这样子是得到了但是要怎么样才能把codeValue中的值斌给于另外一个隐藏域呢?
比如斌于后是这样子的<input type="hidden" name="imginfo" value="CAN">
2007-04-15 22:56
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
得分:0 

有没有代码帮我发一个出来谢谢哦

2007-04-15 22:57
lmhllr
Rank: 8Rank: 8
等 级:贵宾
威 望:44
帖 子:1504
专家分:42
注 册:2005-5-12
收藏
得分:0 
举一反三啊!不难的!


<INPUT id=\"city1\" value=广州 name=Startcity01 codevalue=\"CAN\">
<script language=\"javascript\">
var codeValue = document.getElementById(\"city1\").codevalue;
document.ElementById(\"imginfo\").value=codeValue;
</script>
<input type=\"hidden\" name=\"imginfo\" id=\"imginfo\" value=\"CAN\">
2007-04-16 17:45
swalia
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2006-4-16
收藏
得分:0 
//北京|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;
因为广州是调用这里面的数据,那要是我选择其他地区又不行了,,,
<INPUT id="city1" value=广州 name=Startcity01 codevalue="CAN">
<script language="javascript">
var codeValue = document.getElementById("city1").codevalue;
document.ElementById("imginfo").value=codeValue;
</script>
<input type="hidden" name="imginfo" id="imginfo" value="CAN">
比何在选择中"广州"变成了"上海"那么codeValue里面就应该是"SHA"了.那这样子在变单里面选择里变不过来啊
2007-04-16 19:10
快速回复:如何用JavaScript得到这个值?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.036979 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved