Ver Mensaje Individual
  #109 (permalink)  
Antiguo 04/05/2005, 08:40
Avatar de El_Metallick
El_Metallick
 
Fecha de Ingreso: noviembre-2002
Ubicación: Santiago, Chile
Mensajes: 1.718
Antigüedad: 21 años, 5 meses
Puntos: 16
Catalogo on-line

combo.asp
Código:
<html>
<head>
<title>Combos combinados</title>
<script language = "JavaScript">

<%'CONSULTA PARA OBTENER LOS DATOS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("\database\hard.mdb"))

productos_Sql = "Select distinct familia, codigo, denominacion from articulos "
set rs = CreateObject("ADODB.Recordset")
rs.Open productos_Sql, Conn
x=0
%>
// FUNCION DE COMBO BOX COMBINADO
function sublist(inform, selecteditem)
{
inform.subcatagory.length = 0

<%
count= 0
y=0
do while not rs.eof
%>

x = <%= trim(y) %>;

subcat = new Array();
subcatagorys = "<%=(rs("codigo"))&" "&(rs("denominacion")) %>";
subcatagoryof = "<%=(rs("familia"))%>";
subcatagoryid = "<%=(rs("codigo"))%>";
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
subcat[x,2] = subcatagoryid;
if (subcat[x,1] == selecteditem) {
var option<%= trim(count) %> = new Option(subcat[x,0], subcat[x,2]);
inform.subcatagory.options[inform.subcatagory.length]=option<%= trim(count)%>;
}

<%
count = count + 1
y = y + 1
rs.movenext
loop
rs.close
%>
}
</script>
<base target="principal">
</head>
<body bgcolor="#CDB1B7">
<h2 align="center"><b><i><font color="#AE1732"><u>El PCcillo Feliz</u></font></i></b></h2>
<form name="prueba" method="POST" action="verarticulo.asp">
<div align="center">
<center>
<table border="0" width="80%">
 <tr>
  <td width="77%">
   <select size="1" id="familia" name="familia" onChange = "javascript:sublist(this.form, familia.value);">
	<option selected>Selecciona una familia</option>
	<%
	  familias_Sql = "Select distinct id,familia from familias"
	  rs.Open familias_Sql, Conn
	  do while not rs.eof
	%>
	<option value="<%=rs("id")%>"><%=rs("familia")%></option>
	<%
	  rs.movenext
	  loop
	  set rs=nothing
	  conn.close
	  set conn=nothing
	%>
   </select>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
   <SELECT id="subcatagory" name="subcatagory" size="1">
   <Option selected value="none"></option>
   </SELECT></td>
  <td width="9%">
	<p align="left">
	<input border="0" src="images/submit.gif" name="I4" type="image">
	</p>
  </td>
 </tr>
</table>
</center>
</div>
</form>
</body>
</html>
verarticulo.asp
Código:
<html>
<head>
<title>articulos</title>
<base target="_self">
</head>
<body bgcolor="#CDB1B7">
<p align="center"><font color="#AE1732" face="Verdana" size="2"><b>Detalles</b></font></p>
<p align="center">
<%Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("hard.mdb"))
strSQL = "Select * from articulos where codigo ='" & Request.form("subcatagory")&"'"
Set RS = Conn.Execute(strSQL)
if not rs.eof then%>
</p>
<div align="center">
<center>
<table border="0" width="80%" bgcolor="#0000FF">
<tr>
	<td width="11%"><b><font face="Verdana" size="1" color="#FFFFFF">Codigo:</font></b></td>
	<td width="15%"><font face="Verdana" size="1"><font color="#FFFFFF"><%=rs("codigo")%></font></font></td>
	<td width="74%">
	 <p align="center"><font face="Verdana" size="2" color="#FFFFFF"><b><%=rs("denominacion")%></b></font></td>
</tr>
<tr>
	<td width="100%" colspan="3" >
	 <table border="0" width="100%">
		<tr>
		 <td width="11%">
			<p align="center">&nbsp;</td>
		 <td width="78%" bgcolor="#AE1732">
			<p align="center"><img border="0" src="<%=rs("imagen")%>"></td>
		 <td width="11%">&nbsp;</td>
		</tr>
	 </table>
	</td>
</tr>
<tr>
	<td width="100%" colspan="3">
	 <p align="left"><font face="Verdana" size="1" color="#FFFFFF"><%=rs("descripcion")%></font></td>
</tr>
<tr>
	<td width="11%"><b><font face="Verdana" size="1" color="#FFFFFF">Precio</font></b></td>
	<td width="89%" colspan="2"><font face="Verdana" size="1" color="#FFFFFF"><%=formatcurrency(rs("precio"))%></font></td>
</tr>
</table>
</center>
</div>
<%
rs.close
set rs=nothing
Conn.Close
Set Conn = Nothing
end if
%>
</body>
</html>
combos.htm
Código:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Pagina nueva 1</title>
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
</head>
<frameset framespacing="0" border="0" rows="136,*" frameborder="0">
<frame name="encabezado" scrolling="no" noresize target="principal" src="combo.asp">
<frame name="principal" src="verarticulo.asp">
<noframes>
<body>
<p>Esta página usa marcos, pero su explorador no los admite.</p>
</body>
</noframes>
</frameset>
</html>
hard.mdb

tabla articulos

código (texto)
familia (numérico)
denominacion (texto)
descripcion (memo)
precio (numérico)
imagen (texto)

tabla familias

id (autonumérico)
familia (texto)
imagenp (texto)

Bueno y lo de agregar, eliminar o modificar articulos requiere un minimo conocimiento de ASP (osea es bastante minimo pues hasta yo lo se hacer y no digamos que se mucho jajajaj).... pero de todas formas si no saben hacerlo consulten en el foro .... bueno eso saludos y suerte
__________________
Haz la guerra en la cama y el amor donde se te de la gana...
El tiempo es el mejor maestro, lo único malo es que te mata...¡¡Aprovecha tu tiempo!!