这有效,但前提是表单加载时值存在:
$('CSZ').val(
$('City').val() + ', ' +
$('State').val() + ' ' +
$('Zip']).val()
我尝试了这样的函数来尝试在填充字段时进行连接,但没有奏效。
$('CSZ').blur(function() {
$('City').val() + ', ' +
$('State').val() + ' ' +
$('ZipCode').val()});
但没有得到任何结果。有任何想法吗?
谢谢。
OK this works. Is there any simpler way to write this?
function SetMainLine() {var csz =
$(spec['V08_City']).val() + ', ' +
$(spec['V09_State']).val() + ' ' +
$(spec['V10_ZipCode']).val();
$(spec['V01_Mainline']).val(csz);
}
spec['V08_City'].onchange = SetMainLine;
spec['V09_State'].onchange = SetMainLine;
spec['V10_ZipCode'].onchange = SetMainLine;
The spec[''] is just calling a form field from a database.