Sv Community El Salvador
Soporte y Tecnología => Programación => Base de Datos => Mensaje iniciado por: freezer27 en octubre 19, 2010, 09:45:42 am
-
Que ondas, communiters, estoy haciendo una aplicación web y quisiera saber si alguno de ustedes sabe dónde puedo bajar la base de datos (script con los inserts o algo similar) de los municipios de El Salvador, y de preferencia de otros paises.
He estado buscando pero no encuentro nada, tengo idea que hace varios años encontré uno pero no sé donde :cry: :sad:
-
fijate que vi una que podrias copiar de este site:
http://www.tufuturacasa.com/search/residence_result.cfm?cti=2 (http://www.tufuturacasa.com/search/residence_result.cfm?cti=2)
-
fijate que vi una que podrias copiar de este site:
http://www.tufuturacasa.com/search/residence_result.cfm?cti=2 (http://www.tufuturacasa.com/search/residence_result.cfm?cti=2)
Juela, solo que eso está directamente sobre el código javascript. Yo me refería para tenerlos en la BD, incluso los de otros países (con sus departamentos). Aunque lo que me urge son los de El Salvador :p
Por el momento solo tengo los países, están en http://www.codewalkers.com/c/a/Content-Management-Code/Country-List-For-Forms-Using-SQL por si alguien más los necesita.
-
toma el código javascript parsealo y armas los sql, Sino hace los insert a pie jejej
-
toma el código javascript parsealo y armas los sql, Sino hace los insert a pie jejej
puesi, que le cueste un poquito, ahi esta todo, ya relacionado, departamentos y municipios
-
Yo me arme una asi el año pasado.. me toco hacerla a patita... pero la tengo en la casa... hay te la traigo mañana [Si no la has conseguido]
Saludos
-
Yo me arme una asi el año pasado.. me toco hacerla a patita... pero la tengo en la casa... hay te la traigo mañana [Si no la has conseguido]
Saludos
Gracias :thumbsup:
-
Ya estáaaaaa!!!!
Los 14 departamentos de El Salvador y sus municipios, los fui recopilando y ya tengo mis scripts por si alguien los quiere.
Solo me harían falta los municipios de los demás países, pero eso creo que ya es gula informática jajaja, pero con los de Centroamérica me conformo :P
-
Ya estáaaaaa!!!!
Los 14 departamentos de El Salvador y sus municipios, los fui recopilando y ya tengo mis scripts por si alguien los quiere.
Solo me harían falta los municipios de los demás países, pero eso creo que ya es gula informática jajaja, pero con los de Centroamérica me conformo :P
subi los de el salvador entonces, please :thumbsup:
-
subi los de el salvador entonces, please :thumbsup:
Departamentos:
CREATE TABLE [dbo].[T_DEPARTAMENTOS](
[id] [int] NOT NULL,
[departamento] [nvarchar](50) COLLATE Modern_Spanish_CI_AS NULL,
CONSTRAINT [PK_T_DEPARTAMENTOS] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY];
INSERT INTO t_departamentos (id, departamento) VALUES (1, 'Ahuachapán');
INSERT INTO t_departamentos (id, departamento) VALUES (2, 'Cabañas');
INSERT INTO t_departamentos (id, departamento) VALUES (3, 'Chalatenango');
INSERT INTO t_departamentos (id, departamento) VALUES (4, 'Cuscatlán');
INSERT INTO t_departamentos (id, departamento) VALUES (5, 'La Libertad');
INSERT INTO t_departamentos (id, departamento) VALUES (6, 'La Paz');
INSERT INTO t_departamentos (id, departamento) VALUES (7, 'La Unión');
INSERT INTO t_departamentos (id, departamento) VALUES (8, 'Morazán');
INSERT INTO t_departamentos (id, departamento) VALUES (9, 'San Miguel');
INSERT INTO t_departamentos (id, departamento) VALUES (10, 'San Salvador');
INSERT INTO t_departamentos (id, departamento) VALUES (11, 'San Vicente');
INSERT INTO t_departamentos (id, departamento) VALUES (12, 'Santa Ana');
INSERT INTO t_departamentos (id, departamento) VALUES (13, 'Sonsonate');
INSERT INTO t_departamentos (id, departamento) VALUES (14, 'Usulután');
Municipios:
CREATE TABLE [T_MUNICIPIOS](
[id] [int] NOT NULL,
id_depto [int] NOT NULL,
[municipio] [nvarchar](100) COLLATE Modern_Spanish_CI_AS NOT NULL,
CONSTRAINT [PK_T_MUNICIPIOS] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY];
ALTER TABLE [T_MUNICIPIOS] WITH CHECK ADD CONSTRAINT [FK_T_MUNICIPIOS_T_DEPARTAMENTOS] FOREIGN KEY(id_depto)
REFERENCES [T_DEPARTAMENTOS] ([id])
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (1, 1, 'Ahuachapán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (2, 1, 'Jujutla');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (3, 1, 'Atiquizaya');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (4, 1, 'Concepción de Ataco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (5, 1, 'El Refugio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (6, 1, 'Guaymango');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (7, 1, 'Apaneca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (8, 1, 'San Francisco Menéndez');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (9, 1, 'San Lorenzo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (10, 1, 'San Pedro Puxtla');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (11, 1, 'Tacuba');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (12, 1, 'Turín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (13, 2, 'Cinquera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (14, 2, 'Villa Dolores');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (15, 2, 'Guacotecti');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (16, 2, 'Ilobasco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (17, 2, 'Jutiapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (18, 2, 'San Isidro');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (19, 2, 'Sensuntepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (20, 2, 'Ciudad de Tejutepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (21, 2, 'Victoria');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (22, 3, 'Agua Caliente');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (23, 3, 'Arcatao');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (24, 3, 'Azacualpa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (25, 3, 'Chalatenango');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (26, 3, 'Citalá');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (27, 3, 'Comalapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (28, 3, 'Concepción Quezaltepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (29, 3, 'Dulce Nombre de María');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (30, 3, 'El Carrizal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (31, 3, 'El Paraíso');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (32, 3, 'La Laguna');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (33, 3, 'La Palma');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (34, 3, 'La Reina');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (35, 3, 'Las Vueltas');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (36, 3, 'Nombre de Jesús');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (37, 3, 'Nueva Concepción');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (38, 3, 'Nueva Trinidad');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (39, 3, 'Ojos de Agua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (40, 3, 'Potonico');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (41, 3, 'San Antonio de la Cruz');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (42, 3, 'San Antonio Los Ranchos');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (43, 3, 'San Fernando');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (44, 3, 'San Francisco Lempa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (45, 3, 'San Francisco Morazán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (46, 3, 'San Ignacio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (47, 3, 'San Isidro Labrador');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (48, 3, 'San José Cancasque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (49, 3, 'San José Las Flores');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (50, 3, 'San Luis del Carmen');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (51, 3, 'San Miguel de Mercedes');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (52, 3, 'San Rafael');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (53, 3, 'Santa Rita');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (54, 3, 'Tejutla');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (55, 4, 'Candelaria');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (56, 4, 'Cojutepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (57, 4, 'El Carmen');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (58, 4, 'El Rosario');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (59, 4, 'Monte San Juan');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (60, 4, 'Oratorio de Concepción');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (61, 4, 'San Bartolomé Perulapía');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (62, 4, 'San Cristóbal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (63, 4, 'San José Guayabal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (64, 4, 'San Pedro Perulapán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (65, 4, 'San Rafael Cedros');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (66, 4, 'San Ramón');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (67, 4, 'Santa Cruz Analquito');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (68, 4, 'Santa Cruz Michapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (69, 4, 'Suchitoto');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (70, 4, 'Tenancingo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (71, 5, 'Antiguo Cuscatlán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (72, 5, 'Chiltiupán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (73, 5, 'Ciudad Arce');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (74, 5, 'Colón');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (75, 5, 'Comasagua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (76, 5, 'Huizúcar');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (77, 5, 'Jayaque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (78, 5, 'Jicalapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (79, 5, 'La Libertad');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (80, 5, 'Nueva San Salvador');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (81, 5, 'Nuevo Cuscatlán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (82, 5, 'Opico');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (83, 5, 'Quezaltepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (84, 5, 'Sacacoyo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (85, 5, 'San José Villanueva');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (86, 5, 'San Matías');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (87, 5, 'San Pablo Tacachico');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (88, 5, 'Talnique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (89, 5, 'Tamanique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (90, 5, 'Teotepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (91, 5, 'Tepecoyo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (92, 5, 'Zaragoza');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (93, 6, 'Cuyultitán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (94, 6, 'El Rosario');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (95, 6, 'Jerusalén');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (96, 6, 'Mercedes La Ceiba');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (97, 6, 'Olocuilta');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (98, 6, 'Paraíso de Osorio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (99, 6, 'San Antonio Masahuat');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (100, 6, 'San Emigdio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (101, 6, 'San Francisco Chinameca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (102, 6, 'San Juan Nonualco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (103, 6, 'San Juan Talpa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (104, 6, 'San Juan Tepezontes');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (105, 6, 'San Luis La Herradura');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (106, 6, 'San Luis Talpa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (107, 6, 'San Miguel Tepezontes');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (108, 6, 'San Pedro Masahuat');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (109, 6, 'San Pedro Nonualco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (110, 6, 'San Rafael Obrajuelo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (111, 6, 'Santa María Ostuma');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (112, 6, 'Santiago Nonualco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (113, 6, 'Tapalhuaca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (114, 6, 'Zacatecoluca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (115, 7, 'Anamorós');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (116, 7, 'Bolívar');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (117, 7, 'Concepción de Oriente');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (118, 7, 'Conchagua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (119, 7, 'El Carmen');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (120, 7, 'El Sauce');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (121, 7, 'Intipucá');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (122, 7, 'La Unión');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (123, 7, 'Lislique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (124, 7, 'Meanguera del Golfo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (125, 7, 'Nueva Esparta');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (126, 7, 'Pasaquina');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (127, 7, 'Polorós');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (128, 7, 'San Alejo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (129, 7, 'San José');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (130, 7, 'Santa Rosa de Lima');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (131, 7, 'Yayantique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (132, 7, 'Yucuayquín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (133, 8, 'Arambala');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (134, 8, 'Cacaopera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (135, 8, 'Chilanga');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (136, 8, 'Corinto');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (137, 8, 'Delicias de Concepción');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (138, 8, 'El Divisadero');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (139, 8, 'El Rosario');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (140, 8, 'Gualococti');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (141, 8, 'Guatajiagua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (142, 8, 'Joateca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (143, 8, 'Jocoaitique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (144, 8, 'Jocoro');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (145, 8, 'Lolotiquillo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (146, 8, 'Meanguera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (147, 8, 'Osicala');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (148, 8, 'Perquín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (149, 8, 'San Carlos');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (150, 8, 'San Fernando');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (151, 8, 'San Francisco Gotera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (152, 8, 'San Isidro');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (153, 8, 'San Simón');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (154, 8, 'Sensembra');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (155, 8, 'Sociedad');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (156, 8, 'Torola');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (157, 8, 'Yamabal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (158, 8, 'Yoloaiquín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (159, 9, 'Carolina');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (160, 9, 'Chapeltique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (161, 9, 'Chinameca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (162, 9, 'Chirilagua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (163, 9, 'Ciudad Barrios');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (164, 9, 'Comacarán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (165, 9, 'El Tránsito');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (166, 9, 'Lolotique');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (167, 9, 'Moncagua');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (168, 9, 'Nueva Guadalupe');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (169, 9, 'Nuevo Edén de San Juan');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (170, 9, 'Quelepa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (171, 9, 'San Antonio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (172, 9, 'San Gerardo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (173, 9, 'San Jorge');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (174, 9, 'San Luis de la Reina');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (175, 9, 'San Miguel');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (176, 9, 'San Rafael');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (177, 9, 'Sesori');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (178, 9, 'Uluazapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (179, 10, 'Aguilares');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (180, 10, 'Apopa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (181, 10, 'Ayutuxtepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (182, 10, 'Cuscatancingo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (183, 10, 'Delgado');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (184, 10, 'El Paisnal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (185, 10, 'Guazapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (186, 10, 'Ilopango');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (187, 10, 'Mejicanos');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (188, 10, 'Nejapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (189, 10, 'Panchimalco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (190, 10, 'Rosario de Mora');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (191, 10, 'San Marcos');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (192, 10, 'San Martín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (193, 10, 'San Salvador');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (194, 10, 'Santiago Texacuangos');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (195, 10, 'Santo Tomás');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (196, 10, 'Soyapango');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (197, 10, 'Tonacatepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (198, 11, 'Apastepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (199, 11, 'Guadalupe');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (200, 11, 'San Cayetano Istepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (201, 11, 'San Esteban Catarina');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (202, 11, 'San Ildefonso');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (203, 11, 'San Lorenzo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (204, 11, 'San Sebastián');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (205, 11, 'Santa Clara');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (206, 11, 'Santo Domingo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (207, 11, 'San Vicente');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (208, 11, 'Tecoluca');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (209, 11, 'Tepetitán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (210, 11, 'Verapaz');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (211, 12, 'Candelaria de la Frontera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (212, 12, 'Chalchuapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (213, 12, 'Coatepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (214, 12, 'El Congo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (215, 12, 'El Porvenir');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (216, 12, 'Masahuat');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (217, 12, 'Metapán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (218, 12, 'San Antonio Pajonal');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (219, 12, 'San Sebastián Salitrillo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (220, 12, 'Santa Ana');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (221, 12, 'Santa Rosa Guachipilín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (222, 12, 'Santiago de la Frontera');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (223, 12, 'Texistepeque');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (224, 13, 'Acajutla');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (225, 13, 'Armenia');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (226, 13, 'Caluco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (227, 13, 'Cuisnahuat');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (228, 13, 'Izalco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (229, 13, 'Juayúa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (230, 13, 'Nahuizalco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (231, 13, 'Nahulingo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (232, 13, 'Salcoatitán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (233, 13, 'San Antonio del Monte');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (234, 13, 'San Julián');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (235, 13, 'Santa Catarina Masahuat');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (236, 13, 'Santa Isabel Ishuatán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (237, 13, 'Santo Domingo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (238, 13, 'Sonsonate');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (239, 13, 'Sonzacate');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (240, 14, 'Alegría');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (241, 14, 'Berlín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (242, 14, 'California');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (243, 14, 'Concepción Batres');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (244, 14, 'El Triunfo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (245, 14, 'Ereguayquín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (246, 14, 'Estanzuelas');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (247, 14, 'Jiquilisco');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (248, 14, 'Jucuapa');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (249, 14, 'Jucuarán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (250, 14, 'Mercedes Umaña');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (251, 14, 'Nueva Granada');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (252, 14, 'Ozatlán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (253, 14, 'Puerto El Triunfo');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (254, 14, 'San Agustín');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (255, 14, 'San Buenaventura');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (256, 14, 'San Dionisio');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (257, 14, 'San Francisco Javier');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (258, 14, 'Santa Elena');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (259, 14, 'Santa María');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (260, 14, 'Santiago de María');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (261, 14, 'Tecapán');
INSERT INTO t_municipios (id, id_depto, municipio) VALUES (262, 14, 'Usulután');
Esta carajada no me dejó subir los archivos .sql y me dio weba comprimirlos o cambiarles extensión, así que mejor se los puse directamente aquí, jeje.
-
puesi, que le cueste un poquito, ahi esta todo, ya relacionado, departamentos y municipios
claro no hace daño un poco de esfuerzo
Ya estáaaaaa!!!!
Los 14 departamentos de El Salvador y sus municipios, los fui recopilando y ya tengo mis scripts por si alguien los quiere.
con recopilar te referis a que hicistes los scripts a pie? o como??
Bueno ponete el link para que los que lo necesiten no pasen los mismos problemas que vos :thumbsup:
-
claro no hace daño un poco de esfuerzo
con recopilar te referis a que hicistes los scripts a pie? o como??
Bueno ponete el link para que los que lo necesiten no pasen los mismos problemas que vos :thumbsup:
Encontré el listado todo tocho (mi$$rda) y los fui haciendo. Ya los probé y no dan errores :thumbsup:
-
Yo tenía esas dos tablas jejeje, lastimosamente no me di cuenta antes...
lo siento :D
-
aqui les dejo un codigo funcionando de listas relacionadas para Departamento - Municipio
la acabo de crear :D
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
function fillCategory(){
// this function is used to fill the category list on load
//addOption(document.drop_list.Category, "Ahuachapán", "Ahuachapán", "");
addOption(document.drop_list.Category, "Ahuachapán", "Ahuachapán", "");
addOption(document.drop_list.Category, "Cabañas", "Cabañas", "");
addOption(document.drop_list.Category, "Chalatenango", "Chalatenango", "");
addOption(document.drop_list.Category, "Cuscatlán", "Cuscatlán", "");
addOption(document.drop_list.Category, "La Libertad", "La Libertad", "");
addOption(document.drop_list.Category, "La Paz", "La Paz", "");
addOption(document.drop_list.Category, "La Unión", "La Unión", "");
addOption(document.drop_list.Category, "Morazán", "Morazán", "");
addOption(document.drop_list.Category, "San Miguel", "San Miguel", "");
addOption(document.drop_list.Category, "San Salvador", "San Salvador", "");
addOption(document.drop_list.Category, "San Vicente", "San Vicente", "");
addOption(document.drop_list.Category, "Santa Ana", "Santa Ana", "");
addOption(document.drop_list.Category, "Sonsonate", "Sonsonate", "");
addOption(document.drop_list.Category, "Usulután", "Usulután", "");
}
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "--MUNICIPIO--", "");
if(document.drop_list.Category.value == "Ahuachapán"){
addOption(document.drop_list.SubCat,"Ahuachapán", "Ahuachapán");
addOption(document.drop_list.SubCat,"Jujutla", "Jujutla");
addOption(document.drop_list.SubCat,"Atiquizaya", "Atiquizaya");
addOption(document.drop_list.SubCat,"Concepción de Ataco", "Concepción de Ataco");
addOption(document.drop_list.SubCat,"El Refugio", "El Refugio");
addOption(document.drop_list.SubCat,"Guaymango", "Guaymango");
addOption(document.drop_list.SubCat,"Apaneca", "Apaneca");
addOption(document.drop_list.SubCat,"San Francisco Menéndez", "San Francisco Menéndez");
addOption(document.drop_list.SubCat,"San Lorenzo", "San Lorenzo");
addOption(document.drop_list.SubCat,"San Pedro Puxtla", "San Pedro Puxtla");
addOption(document.drop_list.SubCat,"Tacuba", "Tacuba");
addOption(document.drop_list.SubCat,"Turín", "Turín");
}
if(document.drop_list.Category.value == "Cabañas"){
addOption(document.drop_list.SubCat,"Cinquera", "Cinquera");
addOption(document.drop_list.SubCat,"Villa Dolores", "Villa Dolores");
addOption(document.drop_list.SubCat,"Guacotecti", "Guacotecti");
addOption(document.drop_list.SubCat,"Ilobasco", "Ilobasco");
addOption(document.drop_list.SubCat,"Jutiapa", "Jutiapa");
addOption(document.drop_list.SubCat,"San Isidro", "San Isidro");
addOption(document.drop_list.SubCat,"Sensuntepeque", "Sensuntepeque");
addOption(document.drop_list.SubCat,"Ciudad de Tejutepeque", "Ciudad de Tejutepeque");
addOption(document.drop_list.SubCat,"Victoria", "Victoria");
}
if(document.drop_list.Category.value == "Chalatenango"){
addOption(document.drop_list.SubCat,"Agua Caliente", "Agua Caliente");
addOption(document.drop_list.SubCat,"Arcatao", "Arcatao");
addOption(document.drop_list.SubCat,"Azacualpa", "Azacualpa");
addOption(document.drop_list.SubCat,"Chalatenango", "Chalatenango");
addOption(document.drop_list.SubCat,"Citalá", "Citalá");
addOption(document.drop_list.SubCat,"Comalapa", "Comalapa");
addOption(document.drop_list.SubCat,"Concepción Quezaltepeque", "Concepción Quezaltepeque");
addOption(document.drop_list.SubCat,"Dulce Nombre de María", "Dulce Nombre de María");
addOption(document.drop_list.SubCat,"El Carrizal", "El Carrizal");
addOption(document.drop_list.SubCat,"El Paraíso", "El Paraíso");
addOption(document.drop_list.SubCat,"La Laguna", "La Laguna");
addOption(document.drop_list.SubCat,"La Palma", "La Palma");
addOption(document.drop_list.SubCat,"La Reina", "La Reina");
addOption(document.drop_list.SubCat,"Las Vueltas", "Las Vueltas");
addOption(document.drop_list.SubCat,"Nombre de Jesús", "Nombre de Jesús");
addOption(document.drop_list.SubCat,"Nueva Concepción", "Nueva Concepción");
addOption(document.drop_list.SubCat,"Nueva Trinidad", "Nueva Trinidad");
addOption(document.drop_list.SubCat,"Ojos de Agua", "Ojos de Agua");
addOption(document.drop_list.SubCat,"Potonico", "Potonico");
addOption(document.drop_list.SubCat,"San Antonio de la Cruz", "San Antonio de la Cruz");
addOption(document.drop_list.SubCat,"San Antonio Los Ranchos", "San Antonio Los Ranchos");
addOption(document.drop_list.SubCat,"San Fernando", "San Fernando");
addOption(document.drop_list.SubCat,"San Francisco Lempa", "San Francisco Lempa");
addOption(document.drop_list.SubCat,"San Francisco Morazán", "San Francisco Morazán");
addOption(document.drop_list.SubCat,"San Ignacio", "San Ignacio");
addOption(document.drop_list.SubCat,"San Isidro Labrador", "San Isidro Labrador");
addOption(document.drop_list.SubCat,"San José Cancasque", "San José Cancasque");
addOption(document.drop_list.SubCat,"San José Las Flores", "San José Las Flores");
addOption(document.drop_list.SubCat,"San Luis del Carmen", "San Luis del Carmen");
addOption(document.drop_list.SubCat,"San Miguel de Mercedes", "San Miguel de Mercedes");
addOption(document.drop_list.SubCat,"San Rafael", "San Rafael");
addOption(document.drop_list.SubCat,"Santa Rita", "Santa Rita");
addOption(document.drop_list.SubCat,"Tejutla", "Tejutla");
}
if(document.drop_list.Category.value == "Cuscatlán"){
addOption(document.drop_list.SubCat,"Candelaria", "Candelaria");
addOption(document.drop_list.SubCat,"Cojutepeque", "Cojutepeque");
addOption(document.drop_list.SubCat,"El Carmen", "El Carmen");
addOption(document.drop_list.SubCat,"El Rosario", "El Rosario");
addOption(document.drop_list.SubCat,"Monte San Juan", "Monte San Juan");
addOption(document.drop_list.SubCat,"Oratorio de Concepción", "Oratorio de Concepción");
addOption(document.drop_list.SubCat,"San Bartolomé Perulapía", "San Bartolomé Perulapía");
addOption(document.drop_list.SubCat,"San Cristóbal", "San Cristóbal");
addOption(document.drop_list.SubCat,"San José Guayabal", "San José Guayabal");
addOption(document.drop_list.SubCat,"San Pedro Perulapán", "San Pedro Perulapán");
addOption(document.drop_list.SubCat,"San Rafael Cedros", "San Rafael Cedros");
addOption(document.drop_list.SubCat,"San Ramón", "San Ramón");
addOption(document.drop_list.SubCat,"Santa Cruz Analquito", "Santa Cruz Analquito");
addOption(document.drop_list.SubCat,"Santa Cruz Michapa", "Santa Cruz Michapa");
addOption(document.drop_list.SubCat,"Suchitoto", "Suchitoto");
addOption(document.drop_list.SubCat,"Tenancingo", "Tenancingo");
}
if(document.drop_list.Category.value == "La Libertad"){
addOption(document.drop_list.SubCat,"Antiguo Cuscatlán", "Antiguo Cuscatlán");
addOption(document.drop_list.SubCat,"Chiltiupán", "Chiltiupán");
addOption(document.drop_list.SubCat,"Ciudad Arce", "Ciudad Arce");
addOption(document.drop_list.SubCat,"Colón", "Colón");
addOption(document.drop_list.SubCat,"Comasagua", "Comasagua");
addOption(document.drop_list.SubCat,"Huizúcar", "Huizúcar");
addOption(document.drop_list.SubCat,"Jayaque", "Jayaque");
addOption(document.drop_list.SubCat,"Jicalapa", "Jicalapa");
addOption(document.drop_list.SubCat,"La Libertad", "La Libertad");
addOption(document.drop_list.SubCat,"Nueva San Salvador", "Nueva San Salvador");
addOption(document.drop_list.SubCat,"Nuevo Cuscatlán", "Nuevo Cuscatlán");
addOption(document.drop_list.SubCat,"Opico", "Opico");
addOption(document.drop_list.SubCat,"Quezaltepeque", "Quezaltepeque");
addOption(document.drop_list.SubCat,"Sacacoyo", "Sacacoyo");
addOption(document.drop_list.SubCat,"San José Villanueva", "San José Villanueva");
addOption(document.drop_list.SubCat,"San Matías", "San Matías");
addOption(document.drop_list.SubCat,"San Pablo Tacachico", "San Pablo Tacachico");
addOption(document.drop_list.SubCat,"Talnique", "Talnique");
addOption(document.drop_list.SubCat,"Tamanique", "Tamanique");
addOption(document.drop_list.SubCat,"Teotepeque", "Teotepeque");
addOption(document.drop_list.SubCat,"Tepecoyo", "Tepecoyo");
addOption(document.drop_list.SubCat,"Zaragoza", "Zaragoza");
}
if(document.drop_list.Category.value == "La Paz"){
addOption(document.drop_list.SubCat,"Cuyultitán", "Cuyultitán");
addOption(document.drop_list.SubCat,"El Rosario", "El Rosario");
addOption(document.drop_list.SubCat,"Jerusalén", "Jerusalén");
addOption(document.drop_list.SubCat,"Mercedes La Ceiba", "Mercedes La Ceiba");
addOption(document.drop_list.SubCat,"Olocuilta", "Olocuilta");
addOption(document.drop_list.SubCat,"Paraíso de Osorio", "Paraíso de Osorio");
addOption(document.drop_list.SubCat,"San Antonio Masahuat", "San Antonio Masahuat");
addOption(document.drop_list.SubCat,"San Emigdio", "San Emigdio");
addOption(document.drop_list.SubCat,"San Francisco Chinameca", "San Francisco Chinameca");
addOption(document.drop_list.SubCat,"San Juan Nonualco", "San Juan Nonualco");
addOption(document.drop_list.SubCat,"San Juan Talpa", "San Juan Talpa");
addOption(document.drop_list.SubCat,"San Juan Tepezontes", "San Juan Tepezontes");
addOption(document.drop_list.SubCat,"San Luis La Herradura", "San Luis La Herradura");
addOption(document.drop_list.SubCat,"San Luis Talpa", "San Luis Talpa");
addOption(document.drop_list.SubCat,"San Miguel Tepezontes", "San Miguel Tepezontes");
addOption(document.drop_list.SubCat,"San Pedro Masahuat", "San Pedro Masahuat");
addOption(document.drop_list.SubCat,"San Pedro Nonualco", "San Pedro Nonualco");
addOption(document.drop_list.SubCat,"San Rafael Obrajuelo", "San Rafael Obrajuelo");
addOption(document.drop_list.SubCat,"Santa María Ostuma", "Santa María Ostuma");
addOption(document.drop_list.SubCat,"Santiago Nonualco", "Santiago Nonualco");
addOption(document.drop_list.SubCat,"Tapalhuaca", "Tapalhuaca");
addOption(document.drop_list.SubCat,"Zacatecoluca", "Zacatecoluca");
}
if(document.drop_list.Category.value == "La Unión"){
addOption(document.drop_list.SubCat,"Anamorós", "Anamorós");
addOption(document.drop_list.SubCat,"Bolívar", "Bolívar");
addOption(document.drop_list.SubCat,"Concepción de Oriente", "Concepción de Oriente");
addOption(document.drop_list.SubCat,"Conchagua", "Conchagua");
addOption(document.drop_list.SubCat,"El Carmen", "El Carmen");
addOption(document.drop_list.SubCat,"El Sauce", "El Sauce");
addOption(document.drop_list.SubCat,"Intipucá", "Intipucá");
addOption(document.drop_list.SubCat,"La Unión", "La Unión");
addOption(document.drop_list.SubCat,"Lislique", "Lislique");
addOption(document.drop_list.SubCat,"Meanguera del Golfo", "Meanguera del Golfo");
addOption(document.drop_list.SubCat,"Nueva Esparta", "Nueva Esparta");
addOption(document.drop_list.SubCat,"Pasaquina", "Pasaquina");
addOption(document.drop_list.SubCat,"Polorós", "Polorós");
addOption(document.drop_list.SubCat,"San Alejo", "San Alejo");
addOption(document.drop_list.SubCat,"San José", "San José");
addOption(document.drop_list.SubCat,"Santa Rosa de Lima", "Santa Rosa de Lima");
addOption(document.drop_list.SubCat,"Yayantique", "Yayantique");
addOption(document.drop_list.SubCat,"Yucuayquín", "Yucuayquín");
}
if(document.drop_list.Category.value == "Morazán"){
addOption(document.drop_list.SubCat,"Arambala", "Arambala");
addOption(document.drop_list.SubCat,"Cacaopera", "Cacaopera");
addOption(document.drop_list.SubCat,"Chilanga", "Chilanga");
addOption(document.drop_list.SubCat,"Corinto", "Corinto");
addOption(document.drop_list.SubCat,"Delicias de Concepción", "Delicias de Concepción");
addOption(document.drop_list.SubCat,"El Divisadero", "El Divisadero");
addOption(document.drop_list.SubCat,"El Rosario", "El Rosario");
addOption(document.drop_list.SubCat,"Gualococti", "Gualococti");
addOption(document.drop_list.SubCat,"Guatajiagua", "Guatajiagua");
addOption(document.drop_list.SubCat,"Joateca", "Joateca");
addOption(document.drop_list.SubCat,"Jocoaitique", "Jocoaitique");
addOption(document.drop_list.SubCat,"Jocoro", "Jocoro");
addOption(document.drop_list.SubCat,"Lolotiquillo", "Lolotiquillo");
addOption(document.drop_list.SubCat,"Meanguera", "Meanguera");
addOption(document.drop_list.SubCat,"Osicala", "Osicala");
addOption(document.drop_list.SubCat,"Perquín", "Perquín");
addOption(document.drop_list.SubCat,"San Carlos", "San Carlos");
addOption(document.drop_list.SubCat,"San Fernando", "San Fernando");
addOption(document.drop_list.SubCat,"San Francisco Gotera", "San Francisco Gotera");
addOption(document.drop_list.SubCat,"San Isidro", "San Isidro");
addOption(document.drop_list.SubCat,"San Simón", "San Simón");
addOption(document.drop_list.SubCat,"Sensembra", "Sensembra");
addOption(document.drop_list.SubCat,"Sociedad", "Sociedad");
addOption(document.drop_list.SubCat,"Torola", "Torola");
addOption(document.drop_list.SubCat,"Yamabal", "Yamabal");
addOption(document.drop_list.SubCat,"Yoloaiquín", "Yoloaiquín");
}
if(document.drop_list.Category.value == "San Miguel"){
addOption(document.drop_list.SubCat,"Carolina", "Carolina");
addOption(document.drop_list.SubCat,"Chapeltique", "Chapeltique");
addOption(document.drop_list.SubCat,"Chinameca", "Chinameca");
addOption(document.drop_list.SubCat,"Chirilagua", "Chirilagua");
addOption(document.drop_list.SubCat,"Ciudad Barrios", "Ciudad Barrios");
addOption(document.drop_list.SubCat,"Comacarán", "Comacarán");
addOption(document.drop_list.SubCat,"El Tránsito", "El Tránsito");
addOption(document.drop_list.SubCat,"Lolotique", "Lolotique");
addOption(document.drop_list.SubCat,"Moncagua", "Moncagua");
addOption(document.drop_list.SubCat,"Nueva Guadalupe", "Nueva Guadalupe");
addOption(document.drop_list.SubCat,"Nuevo Edén de San Juan", "Nuevo Edén de San Juan");
addOption(document.drop_list.SubCat,"Quelepa", "Quelepa");
addOption(document.drop_list.SubCat,"San Antonio", "San Antonio");
addOption(document.drop_list.SubCat,"San Gerardo", "San Gerardo");
addOption(document.drop_list.SubCat,"San Jorge", "San Jorge");
addOption(document.drop_list.SubCat,"San Luis de la Reina", "San Luis de la Reina");
addOption(document.drop_list.SubCat,"San Miguel", "San Miguel");
addOption(document.drop_list.SubCat,"San Rafael", "San Rafael");
addOption(document.drop_list.SubCat,"Sesori", "Sesori");
addOption(document.drop_list.SubCat,"Uluazapa", "Uluazapa");
}
if(document.drop_list.Category.value == "San Salvador"){
addOption(document.drop_list.SubCat,"Aguilares", "Aguilares");
addOption(document.drop_list.SubCat,"Apopa", "Apopa");
addOption(document.drop_list.SubCat,"Ayutuxtepeque", "Ayutuxtepeque");
addOption(document.drop_list.SubCat,"Cuscatancingo", "Cuscatancingo");
addOption(document.drop_list.SubCat,"Delgado", "Delgado");
addOption(document.drop_list.SubCat,"El Paisnal", "El Paisnal");
addOption(document.drop_list.SubCat,"Guazapa", "Guazapa");
addOption(document.drop_list.SubCat,"Ilopango", "Ilopango");
addOption(document.drop_list.SubCat,"Mejicanos", "Mejicanos");
addOption(document.drop_list.SubCat,"Nejapa", "Nejapa");
addOption(document.drop_list.SubCat,"Panchimalco", "Panchimalco");
addOption(document.drop_list.SubCat,"Rosario de Mora", "Rosario de Mora");
addOption(document.drop_list.SubCat,"San Marcos", "San Marcos");
addOption(document.drop_list.SubCat,"San Martín", "San Martín");
addOption(document.drop_list.SubCat,"San Salvador", "San Salvador");
addOption(document.drop_list.SubCat,"Santiago Texacuangos", "Santiago Texacuangos");
addOption(document.drop_list.SubCat,"Santo Tomás", "Santo Tomás");
addOption(document.drop_list.SubCat,"Soyapango", "Soyapango");
addOption(document.drop_list.SubCat,"Tonacatepeque", "Tonacatepeque");
}
if(document.drop_list.Category.value == "San Vicente"){
addOption(document.drop_list.SubCat,"Apastepeque", "Apastepeque");
addOption(document.drop_list.SubCat,"Guadalupe", "Guadalupe");
addOption(document.drop_list.SubCat,"San Cayetano Istepeque", "San Cayetano Istepeque");
addOption(document.drop_list.SubCat,"San Esteban Catarina", "San Esteban Catarina");
addOption(document.drop_list.SubCat,"San Ildefonso", "San Ildefonso");
addOption(document.drop_list.SubCat,"San Lorenzo", "San Lorenzo");
addOption(document.drop_list.SubCat,"San Sebastián", "San Sebastián");
addOption(document.drop_list.SubCat,"Santa Clara", "Santa Clara");
addOption(document.drop_list.SubCat,"Santo Domingo", "Santo Domingo");
addOption(document.drop_list.SubCat,"San Vicente", "San Vicente");
addOption(document.drop_list.SubCat,"Tecoluca", "Tecoluca");
addOption(document.drop_list.SubCat,"Tepetitán", "Tepetitán");
addOption(document.drop_list.SubCat,"Verapaz", "Verapaz");
}
if(document.drop_list.Category.value == "Santa Ana"){
addOption(document.drop_list.SubCat,"Candelaria de la Frontera", "Candelaria de la Frontera");
addOption(document.drop_list.SubCat,"Chalchuapa", "Chalchuapa");
addOption(document.drop_list.SubCat,"Coatepeque", "Coatepeque");
addOption(document.drop_list.SubCat,"El Congo", "El Congo");
addOption(document.drop_list.SubCat,"El Porvenir", "El Porvenir");
addOption(document.drop_list.SubCat,"Masahuat", "Masahuat");
addOption(document.drop_list.SubCat,"Metapán", "Metapán");
addOption(document.drop_list.SubCat,"San Antonio Pajonal", "San Antonio Pajonal");
addOption(document.drop_list.SubCat,"San Sebastián Salitrillo", "San Sebastián Salitrillo");
addOption(document.drop_list.SubCat,"Santa Ana", "Santa Ana");
addOption(document.drop_list.SubCat,"Santa Rosa Guachipilín", "Santa Rosa Guachipilín");
addOption(document.drop_list.SubCat,"Santiago de la Frontera", "Santiago de la Frontera");
addOption(document.drop_list.SubCat,"Texistepeque", "Texistepeque");
}
if(document.drop_list.Category.value == "Sonsonate"){
addOption(document.drop_list.SubCat,"Acajutla", "Acajutla");
addOption(document.drop_list.SubCat,"Armenia", "Armenia");
addOption(document.drop_list.SubCat,"Caluco", "Caluco");
addOption(document.drop_list.SubCat,"Cuisnahuat", "Cuisnahuat");
addOption(document.drop_list.SubCat,"Izalco", "Izalco");
addOption(document.drop_list.SubCat,"Juayúa", "Juayúa");
addOption(document.drop_list.SubCat,"Nahuizalco", "Nahuizalco");
addOption(document.drop_list.SubCat,"Nahulingo", "Nahulingo");
addOption(document.drop_list.SubCat,"Salcoatitán", "Salcoatitán");
addOption(document.drop_list.SubCat,"San Antonio del Monte", "San Antonio del Monte");
addOption(document.drop_list.SubCat,"San Julián", "San Julián");
addOption(document.drop_list.SubCat,"Santa Catarina Masahuat", "Santa Catarina Masahuat");
addOption(document.drop_list.SubCat,"Santa Isabel Ishuatán", "Santa Isabel Ishuatán");
addOption(document.drop_list.SubCat,"Santo Domingo", "Santo Domingo");
addOption(document.drop_list.SubCat,"Sonsonate", "Sonsonate");
addOption(document.drop_list.SubCat,"Sonzacate", "Sonzacate");
}
if(document.drop_list.Category.value == "Usulután"){
addOption(document.drop_list.SubCat,"Alegría", "Alegría");
addOption(document.drop_list.SubCat,"Berlín", "Berlín");
addOption(document.drop_list.SubCat,"California", "California");
addOption(document.drop_list.SubCat,"Concepción Batres", "Concepción Batres");
addOption(document.drop_list.SubCat,"El Triunfo", "El Triunfo");
addOption(document.drop_list.SubCat,"Ereguayquín", "Ereguayquín");
addOption(document.drop_list.SubCat,"Estanzuelas", "Estanzuelas");
addOption(document.drop_list.SubCat,"Jiquilisco", "Jiquilisco");
addOption(document.drop_list.SubCat,"Jucuapa", "Jucuapa");
addOption(document.drop_list.SubCat,"Jucuarán", "Jucuarán");
addOption(document.drop_list.SubCat,"Mercedes Umaña", "Mercedes Umaña");
addOption(document.drop_list.SubCat,"Nueva Granada", "Nueva Granada");
addOption(document.drop_list.SubCat,"Ozatlán", "Ozatlán");
addOption(document.drop_list.SubCat,"Puerto El Triunfo", "Puerto El Triunfo");
addOption(document.drop_list.SubCat,"San Agustín", "San Agustín");
addOption(document.drop_list.SubCat,"San Buenaventura", "San Buenaventura");
addOption(document.drop_list.SubCat,"San Dionisio", "San Dionisio");
addOption(document.drop_list.SubCat,"San Francisco Javier", "San Francisco Javier");
addOption(document.drop_list.SubCat,"Santa Elena", "Santa Elena");
addOption(document.drop_list.SubCat,"Santa María", "Santa María");
addOption(document.drop_list.SubCat,"Santiago de María", "Santiago de María");
addOption(document.drop_list.SubCat,"Tecapán", "Tecapán");
addOption(document.drop_list.SubCat,"Usulután", "Usulután");
}
// check if both select are valid
copy_dom();
}
//////////////////
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function dispHandle(obj) {
if (obj.style.display == "none")
obj.style.display = "";
else
obj.style.display = "none";
}
function copy_dom(){
if(document.drop_list.Category.selectedIndex != 0 && document.drop_list.SubCat.selectedIndex != 0){
document.drop_list.domicilio.value =
document.drop_list.Category.options[document.drop_list.Category.selectedIndex].value
+ ", " +
document.drop_list.SubCat.options[document.drop_list.SubCat.selectedIndex].value
} else {
document.drop_list.domicilio.value = '';
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body onload="fillCategory();">
<FORM name="drop_list" action="yourpage.php" method="POST" >
<input name="domicilio" type="text" id="domicilio" value="" size="75" readonly="readonly"/>
<br />
<a href="javascript:dispHandle(vanisher)">Hide/Show</a>
<div id=vanisher style="display:none;">
<SELECT NAME="Category" onChange="SelectSubCat();" >
<Option value="">--DEPARTAMENTO--</option>
</SELECT>
<SELECT id="SubCat" NAME="SubCat" onchange="copy_dom();">
<Option value="">--MUNICIPIO--</option>
</SELECT>
</div>
</form>
</body>
</html>
copien el código y pruebenlo aqui:
http://www.csgnetwork.com/htmlcodetest.html (http://www.csgnetwork.com/htmlcodetest.html)
-
tienen un código de departamento y municipio al azar, no tienen la codificación "oficial" por decirlo así, al tipo del nit...
0821=la paz|zacatecoluca
sólo es una observación, no me vaian a salir con el corbo desembainado....
-
me preguntaron por ahi si era la lista completa de municipios de El Salvador, pues ya los fui a revisar y contar y si estan todos completos :thumbsup:
gracias al freezer27 por el código de llenado de DB, de ahi hice el código para generar el código JS :)
-
me preguntaron por ahi si era la lista completa de municipios de El Salvador, pues ya los fui a revisar y contar y si estan todos completos :thumbsup:
gracias al freezer27 por el código de llenado de DB, de ahi hice el código para generar el código JS :)
Claro, estamos para ayudarnos, no?
A veces paleteamos con alguna onda y de repente aparece alguien con una luz al final del túnel y ya podes salir y ver la luz con tus propios ojos.
jajaja, ando de poeta hoy ;)
-
tienen un código de departamento y municipio al azar, no tienen la codificación "oficial" por decirlo así, al tipo del nit...
0821=la paz|zacatecoluca
sólo es una observación, no me vaian a salir con el corbo desembainado....
Aqui les dejo la codificacion oficial, utilizada en el numero de nit y en demas cosas...
codigo_DEPARTAMENT nombre
01 AHUACHAPAN
02 SANTA ANA
00 OBLIGATORIO
03 SONSONATE
04 CHALATENANGO
05 LA LIBERTAD
06 SAN SALVADOR
07 CUSCATLAN
08 LA PAZ
09 CABAÑAS
10 SAN VICENTE
11 USULUTAN
12 SAN MIGUEL
13 MORAZAN
14 LA UNION
y los municipios
codigo_DEPARTAMENTO codigo_MUNICIPIO nombre_MUNICIPIO
01 01 AHUACHAPAN
01 02 APANECA
01 03 ATIQUIZAYA
01 04 CONCEPCION DE ATACO
01 05 EL REFUGIO
01 06 GUAYMANGO
01 07 JUJUTLA
01 08 SAN FRANCISCO MENENDEZ
01 09 SAN LORENZO
01 10 SAN PEDRO PUXTLA
01 11 TACUBA
01 12 TURIN
02 01 CANDELARIA DE LA FRONTERA
02 02 COATEPEQUE
02 03 CHALCHUAPA
02 04 EL CONGO
02 05 EL PORVENIR
02 06 MASAHUAT
02 07 METAPAN
02 08 SAN ANTONIO PAJONAL
02 09 SAN SEBASTIAN SALITRILLO
02 10 SANTA ANA
02 11 STA ROSA GUACHI
02 12 STGO D LA FRONT
02 13 TEXISTEPEQUE
03 01 ACAJUTLA
03 02 ARMENIA
03 03 CALUCO
03 04 CUISNAHUAT
03 05 STA I ISHUATAN
03 06 IZALCO
03 07 JUAYUA
03 08 NAHUIZALCO
03 09 NAHULINGO
03 10 SALCOATITAN
03 11 SAN ANTONIO DEL MONTE
03 12 SAN JULIAN
03 13 STA C MASAHUAT
03 14 SANTO DOMINGO GUZMAN
03 15 SONSONATE
03 16 SONZACATE
04 01 AGUA CALIENTE
04 02 ARCATAO
04 03 AZACUALPA
04 04 CITALA
04 05 COMALAPA
04 06 CONCEPCION QUEZALTEPEQUE
04 07 CHALATENANGO
04 08 DULCE NOM MARIA
04 09 EL CARRIZAL
04 10 EL PARAISO
04 11 LA LAGUNA
04 12 LA PALMA
04 13 LA REINA
04 14 LAS VUELTAS
04 15 NOMBRE DE JESUS
04 16 NVA CONCEPCION
04 17 NUEVA TRINIDAD
04 18 OJOS DE AGUA
04 19 POTONICO
04 20 SAN ANT LA CRUZ
04 21 SAN ANT RANCHOS
04 22 SAN FERNANDO
04 23 SAN FRANCISCO LEMPA
04 24 SAN FRANCISCO MORAZAN
04 25 SAN IGNACIO
04 26 SAN I LABRADOR
04 27 SAN J CANCASQUE
04 28 SAN JOSE FLORES
04 29 SAN LUIS CARMEN
04 30 SN MIG MERCEDES
04 31 SAN RAFAEL
04 32 SANTA RITA
04 33 TEJUTLA
05 01 ANTGO CUSCATLAN
05 02 CIUDAD ARCE
05 03 COLON
05 04 COMASAGUA
05 05 CHILTIUPAN
05 06 HUIZUCAR
05 07 JAYAQUE
05 08 JICALAPA
05 09 LA LIBERTAD
05 10 NUEVO CUSCATLAN
05 11 SANTA TECLA
05 12 QUEZALTEPEQUE
05 13 SACACOYO
05 14 SN J VILLANUEVA
05 15 SAN JUAN OPICO
05 16 SAN MATIAS
05 17 SAN P TACACHICO
05 18 TAMANIQUE
05 19 TALNIQUE
05 20 TEOTEPEQUE
05 21 TEPECOYO
05 22 ZARAGOZA
06 01 AGUILARES
06 02 APOPA
06 03 AYUTUXTEPEQUE
06 04 CUSCATANCINGO
06 05 EL PAISNAL
06 06 GUAZAPA
06 07 ILOPANGO
06 08 MEJICANOS
06 09 NEJAPA
06 10 PANCHIMALCO
06 11 ROSARIO DE MORA
06 12 SAN MARCOS
06 13 SAN MARTIN
06 14 SAN SALVADOR
06 15 STG TEXACUANGOS
06 16 SANTO TOMAS
06 17 SOYAPANGO
06 18 TONACATEPEQUE
06 19 CIUDAD DELGADO
07 01 CANDELARIA
07 02 COJUTEPEQUE
07 03 EL CARMEN
07 04 EL ROSARIO
07 05 MONTE SAN JUAN
07 06 ORAT CONCEPCION
07 07 SAN B PERULAPIA
07 08 SAN CRISTOBAL
07 09 SAN J GUAYABAL
07 10 SAN P PERULAPAN
07 11 SAN RAF CEDROS
07 12 SAN RAMON
07 13 STA C ANALQUITO
07 14 STA C MICHAPA
07 15 SUCHITOTO
07 16 TENANCINGO
08 01 CUYULTITAN
08 02 ROSARIO LA PAZ
08 03 JERUSALEN
08 04 MERCED LA CEIBA
08 05 OLOCUILTA
08 06 PARAISO OSORIO
08 07 SN ANT MASAHUAT
08 08 SAN EMIGDIO
08 09 SN FCO CHINAMEC
08 10 SAN J NONUALCO
08 11 SAN JUAN TALPA
08 12 SAN JUAN TEPEZONTES
08 13 SAN LUIS TALPA
08 14 SAN MIGUEL TEPEZONTES
08 15 SAN PEDRO MASAHUAT
08 16 SAN PEDRO NONUALCO
08 17 SAN R OBRAJUELO
08 18 STA MA OSTUMA
08 19 STGO NONUALCO
08 20 TAPALHUACA
08 21 ZACATECOLUCA
08 22 SN LUIS LA HERR
09 01 CINQUERA
09 02 GUACOTECTI
09 03 ILOBASCO
09 04 JUTIAPA
09 05 SAN ISIDRO
09 06 SENSUNTEPEQUE
09 07 TEJUTEPEQUE
09 08 VICTORIA
09 09 DOLORES
10 01 APASTEPEQUE
10 02 GUADALUPE
10 03 SAN CAY ISTEPEQ
10 04 SANTA CLARA
10 05 SANTO DOMINGO
10 06 SN EST CATARINA
10 07 SAN ILDEFONSO
10 08 SAN LORENZO
10 09 SAN SEBASTIAN
10 10 SAN VICENTE
10 11 TECOLUCA
10 12 TEPETITAN
10 13 VERAPAZ
11 01 ALEGRIA
11 02 BERLIN
11 03 CALIFORNIA
11 04 CONCEP BATRES
11 05 EL TRIUNFO
11 06 EREGUAYQUIN
11 07 ESTANZUELAS
11 08 JIQUILISCO
11 09 JUCUAPA
11 10 JUCUARAN
11 11 MERCEDES UMAÑA
11 12 NUEVA GRANADA
11 13 OZATLAN
11 14 PTO EL TRIUNFO
11 15 SAN AGUSTIN
11 16 SN BUENAVENTURA
11 17 SAN DIONISIO
11 18 SANTA ELENA
11 19 SAN FCO JAVIER
11 20 SANTA MARIA
11 21 STGO DE MARIA
11 22 TECAPAN
11 23 USULUTAN
12 01 CAROLINA
12 02 CIUDAD BARRIOS
12 03 COMACARAN
12 04 CHAPELTIQUE
12 05 CHINAMECA
12 06 CHIRILAGUA
12 07 EL TRANSITO
12 08 LOLOTIQUE
12 09 MONCAGUA
12 10 NUEVA GUADALUPE
12 11 NVO EDEN S JUAN
12 12 QUELEPA
12 13 SAN ANT D MOSCO
12 14 SAN GERARDO
12 15 SAN JORGE
12 16 SAN LUIS REINA
12 17 SAN MIGUEL
12 18 SAN RAF ORIENTE
12 19 SESORI
12 20 ULUAZAPA
13 01 ARAMBALA
13 02 CACAOPERA
13 03 CORINTO
13 04 CHILANGA
13 05 DELIC DE CONCEP
13 06 EL DIVISADERO
13 07 EL ROSARIO
13 08 GUALOCOCTI
13 09 GUATAJIAGUA
13 10 JOATECA
13 11 JOCOAITIQUE
13 12 JOCORO
13 13 LOLOTIQUILLO
13 14 MEANGUERA
13 15 OSICALA
13 16 PERQUIN
13 17 SAN CARLOS
13 18 SAN FERNANDO
13 19 SAN FCO GOTERA
13 20 SAN ISIDRO
13 21 SAN SIMON
13 22 SENSEMBRA
13 23 SOCIEDAD
13 24 TOROLA
13 25 YAMABAL
13 26 YOLOAIQUIN
14 01 ANAMOROS
14 02 BOLIVAR
14 03 CONCEP DE OTE
14 04 CONCHAGUA
14 05 EL CARMEN
14 06 EL SAUCE
14 07 INTIPUCA
14 08 LA UNION
14 09 LISLIQUE
14 10 MEANG DEL GOLFO
14 11 NUEVA ESPARTA
14 12 PASAQUINA
14 13 POLOROS
14 14 SAN ALEJO
14 15 SAN JOSE
14 16 SANTA ROSA LIMA
14 17 YAYANTIQUE
14 18 YUCUAIQUIN
-
mejora del codigo javascript/html para poner varios dropdowns y sus respectivos textfields en una misma pagina.
body ya no usa la funcion onload.
la dropdown de departamentos esta llena por defecto.
se modificaron las funciones para aceptar cualquier dropdown referenciada por el objeto
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
//function fillCategory(){
//// this function is used to fill the category list on load
////addOption(document.drop_list.Category, "Ahuachapán", "Ahuachapán", "");
//addOption(document.drop_list.Category, "Ahuachapán", "Ahuachapán", "");
//addOption(document.drop_list.Category, "Cabañas", "Cabañas", "");
//addOption(document.drop_list.Category, "Chalatenango", "Chalatenango", "");
//addOption(document.drop_list.Category, "Cuscatlán", "Cuscatlán", "");
//addOption(document.drop_list.Category, "La Libertad", "La Libertad", "");
//addOption(document.drop_list.Category, "La Paz", "La Paz", "");
//addOption(document.drop_list.Category, "La Unión", "La Unión", "");
//addOption(document.drop_list.Category, "Morazán", "Morazán", "");
//addOption(document.drop_list.Category, "San Miguel", "San Miguel", "");
//addOption(document.drop_list.Category, "San Salvador", "San Salvador", "");
//addOption(document.drop_list.Category, "San Vicente", "San Vicente", "");
//addOption(document.drop_list.Category, "Santa Ana", "Santa Ana", "");
//addOption(document.drop_list.Category, "Sonsonate", "Sonsonate", "");
//addOption(document.drop_list.Category, "Usulután", "Usulután", "");
//}
function SelectSubCat(main_select_obj, sec_select_obj){
// ON selection of category this function will work
removeAllOptions(sec_select_obj);
addOption(sec_select_obj, "", "--MUNICIPIO--", "");
if(main_select_obj.value == "Ahuachapán"){
addOption(sec_select_obj,"Ahuachapán", "Ahuachapán");
addOption(sec_select_obj,"Jujutla", "Jujutla");
addOption(sec_select_obj,"Atiquizaya", "Atiquizaya");
addOption(sec_select_obj,"Concepción de Ataco", "Concepción de Ataco");
addOption(sec_select_obj,"El Refugio", "El Refugio");
addOption(sec_select_obj,"Guaymango", "Guaymango");
addOption(sec_select_obj,"Apaneca", "Apaneca");
addOption(sec_select_obj,"San Francisco Menéndez", "San Francisco Menéndez");
addOption(sec_select_obj,"San Lorenzo", "San Lorenzo");
addOption(sec_select_obj,"San Pedro Puxtla", "San Pedro Puxtla");
addOption(sec_select_obj,"Tacuba", "Tacuba");
addOption(sec_select_obj,"Turín", "Turín");
}
if(main_select_obj.value == "Cabañas"){
addOption(sec_select_obj,"Cinquera", "Cinquera");
addOption(sec_select_obj,"Villa Dolores", "Villa Dolores");
addOption(sec_select_obj,"Guacotecti", "Guacotecti");
addOption(sec_select_obj,"Ilobasco", "Ilobasco");
addOption(sec_select_obj,"Jutiapa", "Jutiapa");
addOption(sec_select_obj,"San Isidro", "San Isidro");
addOption(sec_select_obj,"Sensuntepeque", "Sensuntepeque");
addOption(sec_select_obj,"Ciudad de Tejutepeque", "Ciudad de Tejutepeque");
addOption(sec_select_obj,"Victoria", "Victoria");
}
if(main_select_obj.value == "Chalatenango"){
addOption(sec_select_obj,"Agua Caliente", "Agua Caliente");
addOption(sec_select_obj,"Arcatao", "Arcatao");
addOption(sec_select_obj,"Azacualpa", "Azacualpa");
addOption(sec_select_obj,"Chalatenango", "Chalatenango");
addOption(sec_select_obj,"Citalá", "Citalá");
addOption(sec_select_obj,"Comalapa", "Comalapa");
addOption(sec_select_obj,"Concepción Quezaltepeque", "Concepción Quezaltepeque");
addOption(sec_select_obj,"Dulce Nombre de María", "Dulce Nombre de María");
addOption(sec_select_obj,"El Carrizal", "El Carrizal");
addOption(sec_select_obj,"El Paraíso", "El Paraíso");
addOption(sec_select_obj,"La Laguna", "La Laguna");
addOption(sec_select_obj,"La Palma", "La Palma");
addOption(sec_select_obj,"La Reina", "La Reina");
addOption(sec_select_obj,"Las Vueltas", "Las Vueltas");
addOption(sec_select_obj,"Nombre de Jesús", "Nombre de Jesús");
addOption(sec_select_obj,"Nueva Concepción", "Nueva Concepción");
addOption(sec_select_obj,"Nueva Trinidad", "Nueva Trinidad");
addOption(sec_select_obj,"Ojos de Agua", "Ojos de Agua");
addOption(sec_select_obj,"Potonico", "Potonico");
addOption(sec_select_obj,"San Antonio de la Cruz", "San Antonio de la Cruz");
addOption(sec_select_obj,"San Antonio Los Ranchos", "San Antonio Los Ranchos");
addOption(sec_select_obj,"San Fernando", "San Fernando");
addOption(sec_select_obj,"San Francisco Lempa", "San Francisco Lempa");
addOption(sec_select_obj,"San Francisco Morazán", "San Francisco Morazán");
addOption(sec_select_obj,"San Ignacio", "San Ignacio");
addOption(sec_select_obj,"San Isidro Labrador", "San Isidro Labrador");
addOption(sec_select_obj,"San José Cancasque", "San José Cancasque");
addOption(sec_select_obj,"San José Las Flores", "San José Las Flores");
addOption(sec_select_obj,"San Luis del Carmen", "San Luis del Carmen");
addOption(sec_select_obj,"San Miguel de Mercedes", "San Miguel de Mercedes");
addOption(sec_select_obj,"San Rafael", "San Rafael");
addOption(sec_select_obj,"Santa Rita", "Santa Rita");
addOption(sec_select_obj,"Tejutla", "Tejutla");
}
if(main_select_obj.value == "Cuscatlán"){
addOption(sec_select_obj,"Candelaria", "Candelaria");
addOption(sec_select_obj,"Cojutepeque", "Cojutepeque");
addOption(sec_select_obj,"El Carmen", "El Carmen");
addOption(sec_select_obj,"El Rosario", "El Rosario");
addOption(sec_select_obj,"Monte San Juan", "Monte San Juan");
addOption(sec_select_obj,"Oratorio de Concepción", "Oratorio de Concepción");
addOption(sec_select_obj,"San Bartolomé Perulapía", "San Bartolomé Perulapía");
addOption(sec_select_obj,"San Cristóbal", "San Cristóbal");
addOption(sec_select_obj,"San José Guayabal", "San José Guayabal");
addOption(sec_select_obj,"San Pedro Perulapán", "San Pedro Perulapán");
addOption(sec_select_obj,"San Rafael Cedros", "San Rafael Cedros");
addOption(sec_select_obj,"San Ramón", "San Ramón");
addOption(sec_select_obj,"Santa Cruz Analquito", "Santa Cruz Analquito");
addOption(sec_select_obj,"Santa Cruz Michapa", "Santa Cruz Michapa");
addOption(sec_select_obj,"Suchitoto", "Suchitoto");
addOption(sec_select_obj,"Tenancingo", "Tenancingo");
}
if(main_select_obj.value == "La Libertad"){
addOption(sec_select_obj,"Antiguo Cuscatlán", "Antiguo Cuscatlán");
addOption(sec_select_obj,"Chiltiupán", "Chiltiupán");
addOption(sec_select_obj,"Ciudad Arce", "Ciudad Arce");
addOption(sec_select_obj,"Colón", "Colón");
addOption(sec_select_obj,"Comasagua", "Comasagua");
addOption(sec_select_obj,"Huizúcar", "Huizúcar");
addOption(sec_select_obj,"Jayaque", "Jayaque");
addOption(sec_select_obj,"Jicalapa", "Jicalapa");
addOption(sec_select_obj,"La Libertad", "La Libertad");
addOption(sec_select_obj,"Nueva San Salvador", "Nueva San Salvador");
addOption(sec_select_obj,"Nuevo Cuscatlán", "Nuevo Cuscatlán");
addOption(sec_select_obj,"Opico", "Opico");
addOption(sec_select_obj,"Quezaltepeque", "Quezaltepeque");
addOption(sec_select_obj,"Sacacoyo", "Sacacoyo");
addOption(sec_select_obj,"San José Villanueva", "San José Villanueva");
addOption(sec_select_obj,"San Matías", "San Matías");
addOption(sec_select_obj,"San Pablo Tacachico", "San Pablo Tacachico");
addOption(sec_select_obj,"Talnique", "Talnique");
addOption(sec_select_obj,"Tamanique", "Tamanique");
addOption(sec_select_obj,"Teotepeque", "Teotepeque");
addOption(sec_select_obj,"Tepecoyo", "Tepecoyo");
addOption(sec_select_obj,"Zaragoza", "Zaragoza");
}
if(main_select_obj.value == "La Paz"){
addOption(sec_select_obj,"Cuyultitán", "Cuyultitán");
addOption(sec_select_obj,"El Rosario", "El Rosario");
addOption(sec_select_obj,"Jerusalén", "Jerusalén");
addOption(sec_select_obj,"Mercedes La Ceiba", "Mercedes La Ceiba");
addOption(sec_select_obj,"Olocuilta", "Olocuilta");
addOption(sec_select_obj,"Paraíso de Osorio", "Paraíso de Osorio");
addOption(sec_select_obj,"San Antonio Masahuat", "San Antonio Masahuat");
addOption(sec_select_obj,"San Emigdio", "San Emigdio");
addOption(sec_select_obj,"San Francisco Chinameca", "San Francisco Chinameca");
addOption(sec_select_obj,"San Juan Nonualco", "San Juan Nonualco");
addOption(sec_select_obj,"San Juan Talpa", "San Juan Talpa");
addOption(sec_select_obj,"San Juan Tepezontes", "San Juan Tepezontes");
addOption(sec_select_obj,"San Luis La Herradura", "San Luis La Herradura");
addOption(sec_select_obj,"San Luis Talpa", "San Luis Talpa");
addOption(sec_select_obj,"San Miguel Tepezontes", "San Miguel Tepezontes");
addOption(sec_select_obj,"San Pedro Masahuat", "San Pedro Masahuat");
addOption(sec_select_obj,"San Pedro Nonualco", "San Pedro Nonualco");
addOption(sec_select_obj,"San Rafael Obrajuelo", "San Rafael Obrajuelo");
addOption(sec_select_obj,"Santa María Ostuma", "Santa María Ostuma");
addOption(sec_select_obj,"Santiago Nonualco", "Santiago Nonualco");
addOption(sec_select_obj,"Tapalhuaca", "Tapalhuaca");
addOption(sec_select_obj,"Zacatecoluca", "Zacatecoluca");
}
if(main_select_obj.value == "La Unión"){
addOption(sec_select_obj,"Anamorós", "Anamorós");
addOption(sec_select_obj,"Bolívar", "Bolívar");
addOption(sec_select_obj,"Concepción de Oriente", "Concepción de Oriente");
addOption(sec_select_obj,"Conchagua", "Conchagua");
addOption(sec_select_obj,"El Carmen", "El Carmen");
addOption(sec_select_obj,"El Sauce", "El Sauce");
addOption(sec_select_obj,"Intipucá", "Intipucá");
addOption(sec_select_obj,"La Unión", "La Unión");
addOption(sec_select_obj,"Lislique", "Lislique");
addOption(sec_select_obj,"Meanguera del Golfo", "Meanguera del Golfo");
addOption(sec_select_obj,"Nueva Esparta", "Nueva Esparta");
addOption(sec_select_obj,"Pasaquina", "Pasaquina");
addOption(sec_select_obj,"Polorós", "Polorós");
addOption(sec_select_obj,"San Alejo", "San Alejo");
addOption(sec_select_obj,"San José", "San José");
addOption(sec_select_obj,"Santa Rosa de Lima", "Santa Rosa de Lima");
addOption(sec_select_obj,"Yayantique", "Yayantique");
addOption(sec_select_obj,"Yucuayquín", "Yucuayquín");
}
if(main_select_obj.value == "Morazán"){
addOption(sec_select_obj,"Arambala", "Arambala");
addOption(sec_select_obj,"Cacaopera", "Cacaopera");
addOption(sec_select_obj,"Chilanga", "Chilanga");
addOption(sec_select_obj,"Corinto", "Corinto");
addOption(sec_select_obj,"Delicias de Concepción", "Delicias de Concepción");
addOption(sec_select_obj,"El Divisadero", "El Divisadero");
addOption(sec_select_obj,"El Rosario", "El Rosario");
addOption(sec_select_obj,"Gualococti", "Gualococti");
addOption(sec_select_obj,"Guatajiagua", "Guatajiagua");
addOption(sec_select_obj,"Joateca", "Joateca");
addOption(sec_select_obj,"Jocoaitique", "Jocoaitique");
addOption(sec_select_obj,"Jocoro", "Jocoro");
addOption(sec_select_obj,"Lolotiquillo", "Lolotiquillo");
addOption(sec_select_obj,"Meanguera", "Meanguera");
addOption(sec_select_obj,"Osicala", "Osicala");
addOption(sec_select_obj,"Perquín", "Perquín");
addOption(sec_select_obj,"San Carlos", "San Carlos");
addOption(sec_select_obj,"San Fernando", "San Fernando");
addOption(sec_select_obj,"San Francisco Gotera", "San Francisco Gotera");
addOption(sec_select_obj,"San Isidro", "San Isidro");
addOption(sec_select_obj,"San Simón", "San Simón");
addOption(sec_select_obj,"Sensembra", "Sensembra");
addOption(sec_select_obj,"Sociedad", "Sociedad");
addOption(sec_select_obj,"Torola", "Torola");
addOption(sec_select_obj,"Yamabal", "Yamabal");
addOption(sec_select_obj,"Yoloaiquín", "Yoloaiquín");
}
if(main_select_obj.value == "San Miguel"){
addOption(sec_select_obj,"Carolina", "Carolina");
addOption(sec_select_obj,"Chapeltique", "Chapeltique");
addOption(sec_select_obj,"Chinameca", "Chinameca");
addOption(sec_select_obj,"Chirilagua", "Chirilagua");
addOption(sec_select_obj,"Ciudad Barrios", "Ciudad Barrios");
addOption(sec_select_obj,"Comacarán", "Comacarán");
addOption(sec_select_obj,"El Tránsito", "El Tránsito");
addOption(sec_select_obj,"Lolotique", "Lolotique");
addOption(sec_select_obj,"Moncagua", "Moncagua");
addOption(sec_select_obj,"Nueva Guadalupe", "Nueva Guadalupe");
addOption(sec_select_obj,"Nuevo Edén de San Juan", "Nuevo Edén de San Juan");
addOption(sec_select_obj,"Quelepa", "Quelepa");
addOption(sec_select_obj,"San Antonio", "San Antonio");
addOption(sec_select_obj,"San Gerardo", "San Gerardo");
addOption(sec_select_obj,"San Jorge", "San Jorge");
addOption(sec_select_obj,"San Luis de la Reina", "San Luis de la Reina");
addOption(sec_select_obj,"San Miguel", "San Miguel");
addOption(sec_select_obj,"San Rafael", "San Rafael");
addOption(sec_select_obj,"Sesori", "Sesori");
addOption(sec_select_obj,"Uluazapa", "Uluazapa");
}
if(main_select_obj.value == "San Salvador"){
addOption(sec_select_obj,"Aguilares", "Aguilares");
addOption(sec_select_obj,"Apopa", "Apopa");
addOption(sec_select_obj,"Ayutuxtepeque", "Ayutuxtepeque");
addOption(sec_select_obj,"Cuscatancingo", "Cuscatancingo");
addOption(sec_select_obj,"Delgado", "Delgado");
addOption(sec_select_obj,"El Paisnal", "El Paisnal");
addOption(sec_select_obj,"Guazapa", "Guazapa");
addOption(sec_select_obj,"Ilopango", "Ilopango");
addOption(sec_select_obj,"Mejicanos", "Mejicanos");
addOption(sec_select_obj,"Nejapa", "Nejapa");
addOption(sec_select_obj,"Panchimalco", "Panchimalco");
addOption(sec_select_obj,"Rosario de Mora", "Rosario de Mora");
addOption(sec_select_obj,"San Marcos", "San Marcos");
addOption(sec_select_obj,"San Martín", "San Martín");
addOption(sec_select_obj,"San Salvador", "San Salvador");
addOption(sec_select_obj,"Santiago Texacuangos", "Santiago Texacuangos");
addOption(sec_select_obj,"Santo Tomás", "Santo Tomás");
addOption(sec_select_obj,"Soyapango", "Soyapango");
addOption(sec_select_obj,"Tonacatepeque", "Tonacatepeque");
}
if(main_select_obj.value == "San Vicente"){
addOption(sec_select_obj,"Apastepeque", "Apastepeque");
addOption(sec_select_obj,"Guadalupe", "Guadalupe");
addOption(sec_select_obj,"San Cayetano Istepeque", "San Cayetano Istepeque");
addOption(sec_select_obj,"San Esteban Catarina", "San Esteban Catarina");
addOption(sec_select_obj,"San Ildefonso", "San Ildefonso");
addOption(sec_select_obj,"San Lorenzo", "San Lorenzo");
addOption(sec_select_obj,"San Sebastián", "San Sebastián");
addOption(sec_select_obj,"Santa Clara", "Santa Clara");
addOption(sec_select_obj,"Santo Domingo", "Santo Domingo");
addOption(sec_select_obj,"San Vicente", "San Vicente");
addOption(sec_select_obj,"Tecoluca", "Tecoluca");
addOption(sec_select_obj,"Tepetitán", "Tepetitán");
addOption(sec_select_obj,"Verapaz", "Verapaz");
}
if(main_select_obj.value == "Santa Ana"){
addOption(sec_select_obj,"Candelaria de la Frontera", "Candelaria de la Frontera");
addOption(sec_select_obj,"Chalchuapa", "Chalchuapa");
addOption(sec_select_obj,"Coatepeque", "Coatepeque");
addOption(sec_select_obj,"El Congo", "El Congo");
addOption(sec_select_obj,"El Porvenir", "El Porvenir");
addOption(sec_select_obj,"Masahuat", "Masahuat");
addOption(sec_select_obj,"Metapán", "Metapán");
addOption(sec_select_obj,"San Antonio Pajonal", "San Antonio Pajonal");
addOption(sec_select_obj,"San Sebastián Salitrillo", "San Sebastián Salitrillo");
addOption(sec_select_obj,"Santa Ana", "Santa Ana");
addOption(sec_select_obj,"Santa Rosa Guachipilín", "Santa Rosa Guachipilín");
addOption(sec_select_obj,"Santiago de la Frontera", "Santiago de la Frontera");
addOption(sec_select_obj,"Texistepeque", "Texistepeque");
}
if(main_select_obj.value == "Sonsonate"){
addOption(sec_select_obj,"Acajutla", "Acajutla");
addOption(sec_select_obj,"Armenia", "Armenia");
addOption(sec_select_obj,"Caluco", "Caluco");
addOption(sec_select_obj,"Cuisnahuat", "Cuisnahuat");
addOption(sec_select_obj,"Izalco", "Izalco");
addOption(sec_select_obj,"Juayúa", "Juayúa");
addOption(sec_select_obj,"Nahuizalco", "Nahuizalco");
addOption(sec_select_obj,"Nahulingo", "Nahulingo");
addOption(sec_select_obj,"Salcoatitán", "Salcoatitán");
addOption(sec_select_obj,"San Antonio del Monte", "San Antonio del Monte");
addOption(sec_select_obj,"San Julián", "San Julián");
addOption(sec_select_obj,"Santa Catarina Masahuat", "Santa Catarina Masahuat");
addOption(sec_select_obj,"Santa Isabel Ishuatán", "Santa Isabel Ishuatán");
addOption(sec_select_obj,"Santo Domingo", "Santo Domingo");
addOption(sec_select_obj,"Sonsonate", "Sonsonate");
addOption(sec_select_obj,"Sonzacate", "Sonzacate");
}
if(main_select_obj.value == "Usulután"){
addOption(sec_select_obj,"Alegría", "Alegría");
addOption(sec_select_obj,"Berlín", "Berlín");
addOption(sec_select_obj,"California", "California");
addOption(sec_select_obj,"Concepción Batres", "Concepción Batres");
addOption(sec_select_obj,"El Triunfo", "El Triunfo");
addOption(sec_select_obj,"Ereguayquín", "Ereguayquín");
addOption(sec_select_obj,"Estanzuelas", "Estanzuelas");
addOption(sec_select_obj,"Jiquilisco", "Jiquilisco");
addOption(sec_select_obj,"Jucuapa", "Jucuapa");
addOption(sec_select_obj,"Jucuarán", "Jucuarán");
addOption(sec_select_obj,"Mercedes Umaña", "Mercedes Umaña");
addOption(sec_select_obj,"Nueva Granada", "Nueva Granada");
addOption(sec_select_obj,"Ozatlán", "Ozatlán");
addOption(sec_select_obj,"Puerto El Triunfo", "Puerto El Triunfo");
addOption(sec_select_obj,"San Agustín", "San Agustín");
addOption(sec_select_obj,"San Buenaventura", "San Buenaventura");
addOption(sec_select_obj,"San Dionisio", "San Dionisio");
addOption(sec_select_obj,"San Francisco Javier", "San Francisco Javier");
addOption(sec_select_obj,"Santa Elena", "Santa Elena");
addOption(sec_select_obj,"Santa María", "Santa María");
addOption(sec_select_obj,"Santiago de María", "Santiago de María");
addOption(sec_select_obj,"Tecapán", "Tecapán");
addOption(sec_select_obj,"Usulután", "Usulután");
}
// check if both select are valid
copy_dom();
}
//////////////////
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function dispHandle(obj) {
if (obj.style.display == "none")
obj.style.display = "";
else
obj.style.display = "none";
}
function copy_dom(textf, maincat, subcat){
if(maincat.selectedIndex != 0 && subcat.selectedIndex != 0){
textf.value =
maincat.options[maincat.selectedIndex].value
+ ", " +
subcat.options[subcat.selectedIndex].value
} else {
textf.value = '';
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body >
<FORM name="drop_list" action="yourpage.php" method="POST" >
<input name="domicilio" type="text" id="domicilio" value="" size="75" readonly="readonly"/>
<br />
<a href="javascript:dispHandle(vanisher)">Hide/Show</a>
<div id=vanisher style="display:none;" >
<SELECT NAME="Category" id="Category" onChange="SelectSubCat(document.drop_list.Category, document.drop_list.SubCat);" >
<option value="0">--DEPARTAMENTO--</option>
<option value="Ahuachapán">Ahuachapán</option>
<option value="Cabañas">Cabañas</option>
<option value="Chalatenango">Chalatenango</option>
<option value="Cuscatlán">Cuscatlán</option>
<option value="La Libertad">La Libertad</option>
<option value="La Paz">La Paz</option>
<option value="La Unión">La Unión</option>
<option value="Morazán">Morazán</option>
<option value="San Miguel">San Miguel</option>
<option value="San Salvador">San Salvador</option>
<option value="San Vicente">San Vicente</option>
<option value="Santa Ana">Santa Ana</option>
<option value="Sonsonate">Sonsonate</option>
<option value="Usulután">Usulután</option>
</SELECT>
<SELECT id="SubCat" NAME="SubCat" onchange="copy_dom(document.drop_list.domicilio,document.drop_list.Category, document.drop_list.SubCat);">
<Option value="">--MUNICIPIO--</option>
</SELECT>
</div>
</form>
<p><FORM name="drop_list2" action="yourpage.php" method="POST" >
<input name="domicilio2" type="text" id="domicilio2" value="" size="75" readonly="readonly"/>
<br />
<a href="javascript:dispHandle(vanisher2)">Hide/Show</a>
<div id=vanisher2 style="display:none;" >
<SELECT NAME="Category2" id="Category2" onChange="SelectSubCat(document.drop_list2.Category2, document.drop_list2.SubCat2);" >
<option value="0">--DEPARTAMENTO--</option>
<option value="Ahuachapán">Ahuachapán</option>
<option value="Cabañas">Cabañas</option>
<option value="Chalatenango">Chalatenango</option>
<option value="Cuscatlán">Cuscatlán</option>
<option value="La Libertad">La Libertad</option>
<option value="La Paz">La Paz</option>
<option value="La Unión">La Unión</option>
<option value="Morazán">Morazán</option>
<option value="San Miguel">San Miguel</option>
<option value="San Salvador">San Salvador</option>
<option value="San Vicente">San Vicente</option>
<option value="Santa Ana">Santa Ana</option>
<option value="Sonsonate">Sonsonate</option>
<option value="Usulután">Usulután</option>
</SELECT>
<SELECT id="SubCat2" NAME="SubCat2" onchange="copy_dom(document.drop_list2.domicilio2,document.drop_list2.Category2, document.drop_list2.SubCat2);">
<Option value="">--MUNICIPIO--</option>
</SELECT>
</div>
</form></p>
</body>
</html>
-
jeje, ya vi que se rebuscan, aunque como ese último código de Naruto aplicaría si solo son los municipios (o ciudades) para un determinado país, aparte que para manejarlo a nivel de BD es mejor manejar los códigos como numéricos (a mi forma de ver) porque es más práctico almacenar los códigos solamente.
-
un update en el código de municipios:
en San Salvador, un municipio esta como "Delgado", en muchos textos en internet aparece asi, pero en los DUIs de personas que viven ahi aparece como "Ciudad Delgado".
Favor notar antes de comenzar a usar.