我收到了一个大量的excel文件,其中包含一列“旧”数字和一栏旁边的“新”数字。
我已将其导出为csv文件
我需要创建一个html表单,允许用户输入旧号码,以便显示新号码。
任何帮助都将不胜感激。
答案 0 :(得分:1)
HTML
<div>
<input type="text" id="old-number" placeholder="old number" />
<button id="convert">convert</button>
<input type="text" id="new-number" placeholder="new number" readonly />
</div>
<div>
<input type="text" id="name" placeholder="name" readonly />
<input type="text" id="city" placeholder="city" readonly />
</div>
的CoffeeScript
conversion =
15128:
number: 11599
name: 'name-of-11599'
city: 'city-of-11599'
15129:
number: 11680
name: 'name-of-11680'
city: 'city-of-11680'
15130:
number: 11691
name: 'name-of-11691'
city: 'city-of-11691'
15132:
number: 11694
name: 'name-of-11694'
city: 'city-of-11694'
10097:
number: 14051
name: 'name-of-14051'
city: 'city-of-14051'
10022:
number: 14094
name: 'name-of-14094'
city: 'city-of-14094'
convert = ->
old_number = $('#old-number').val()
new_data = conversion[old_number]
if new_data
$('#new-number').val(new_data.number)
$('#name').val(new_data.name)
$('#city').val(new_data.city)
else
$('#new-number').val('Not found')
$('#name').val('')
$('#city').val('')
$('#convert').click(convert)
$('#old-number').keydown (e) ->
if e.which == 13
convert()