Ver Mensaje Individual
  #3 (permalink)  
Antiguo 23/04/2003, 07:11
Avatar de comarine
comarine
 
Fecha de Ingreso: enero-2003
Ubicación: Ciudad Autónoma de Buenos Aires
Mensajes: 48
Antigüedad: 21 años, 4 meses
Puntos: 0
Gracias Tx por contestar.
El ejemplo que me decís lo encontré cuando estuve buscando información y me pareció muy interesante, me bajé el zip para tomarlo como base en alguna aplicación, pero no resuelve mi problema actual. Yo simplemente quiero armar un popup con el nombre de distintas marcas que contiene un XML para cambiar el logo y el color de fondo. El PROBLEMA es que en mi PC anda bárbaro pero cuando lo pongo en el servidor con IIS 4, en la instrucción
var nodo=raiz.childNodes.item(indice);
me dice que no es un objeto y para peor con asp no tengo problemas para leer XML ni para correr los ejemplos que vos me indicaste.

El XML es el siguiente:

<?xml version="1.0" encoding="ISO8859-1" ?>
- <TMARCAS>
- <MARCAS>
<ID>1</ID>
<MARCA>Nombre Marca 1</MARCA>
</MARCAS>
- <MARCAS>
<ID>2</ID>
<MARCA>Nombre Marca 2</MARCA>
</MARCAS>
- <MARCAS>
<ID>3</ID>
<MARCA>Nombre Marca 3</MARCA>
</MARCAS>
</TMARCAS>

y el HTML es así:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT Language="JavaScript">
var xmlDoc=new ActiveXObject("microsoft.xmlDom");
xmlDoc.load("marcas.xml");
var raiz=xmlDoc.documentElement;
indice=0;
nommarca="";

function mostrar(indice) {
if (indice!=0) {
indice--;
raiz=xmlDoc.documentElement;
var nodo=raiz.childNodes.item(indice);
nommarca=nodo.childNodes.item(1).text;
document.body.style.backgroundImage='url(images/fdo'+nodo.childNodes.item(0).text+'.gif)';
document.imag.src='images/logo'+nodo.childNodes.item(0).text+'.gif';
}
}

function mostrarload(indice) {
var nodo=raiz.childNodes.item(indice);
document.body.style.backgroundImage='url(imagenes/fdo'+nodo.childNodes.item(0).text+'.gif)';
document.imag.src='imagenes/logo'+nodo.childNodes.item(0).text+'.gif';
nommarca=nodo.childNodes.item(1).text;
for (i=0;i<raiz.childNodes.length;i++) {
nodo=raiz.childNodes.item(i);
var oOption = document.createElement("option");
document.all("nmarca").add(oOption);
oOption.innerText = nodo.childNodes.item(1).text;
oOption.value = i+1;
}
}
</SCRIPT>
<title></title>
</head>
<body onLoad="mostrarload(indice)" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#FFFFFF" link="#FFFFFF" vlink="#FFFFFF" alink="#FFFFFF">
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left"><img name="imag"></td>
<td align="right"><b>Marca:</b><select id="nmarca" name="menu" onChange="mostrar(this.value)"></select></td>
</tr>
</table>
</body>
</html>

Saludos