statesmanagement.js

来自「一款C2C的网店程序 我也是在网上下载的」· JavaScript 代码 · 共 25 行

JS
25
字号
$(document).ready(function(){
	$('select#id_country').change(function(){
		updateState();
	});
	updateState();
});

function updateState()
{
	$('select#id_state option:not(:first-child)').remove();
		var states = countries[$('select#id_country').val()];
		if( typeof(states) != 'undefined' )
		{
			for (indexState in states)
			{
				//ie bug fix
				if (indexState != 'indexOf')
					$('select#id_state').append('<option value="'+indexState+'"'+ (idSelectedCountry == indexState ? ' selected="selected' : '') + '">'+states[indexState]+'</option>');
			}
			$('p.id_state:hidden').slideDown('slow');
		}
		else
			$('p.id_state').slideUp('fast');
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?