Foros del Web » Programando para Internet » Javascript »

erro en subcategoria

Estas en el tema de erro en subcategoria en el foro de Javascript en Foros del Web. Hola estaba checando mi catalogo de productos y me di cuenta que tiene un error, aparentemente no afecta, ni fallar, arroja los resultados que deseo ...
  #1 (permalink)  
Antiguo 28/09/2006, 15:37
 
Fecha de Ingreso: junio-2006
Mensajes: 104
Antigüedad: 17 años, 10 meses
Puntos: 1
erro en subcategoria

Hola estaba checando mi catalogo de productos y me di cuenta que tiene un error, aparentemente no afecta, ni fallar, arroja los resultados que deseo bien, pero en la parte inferior del IE me manda un mensaje que dice: Subcategory es nulo o no es un objeto.
linea: 12
car: 3
Url:http://localhost/venta.asp

Y aqui les dejo los archivos.

venta.asp
Código:
<html> <head>
<link rel="STYLESHEET" type="text/css" href="css/letras.css">
<meta http-equiv="Content-Language" content="es">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<title>Ventas</title> 
<!--#include file="Funciones.asp"--> 
</head>
<body >
<% dim cant
   dim pre
   dim mul

Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("./Ventas2.mdb"))%>

<h1 align="center">Venta de productos</h1>

<h6 align="center"></h6>
<form name="FRMCLIENTE" method=POST target=_self action="carro.asp">
<p align="center"><b>Seleccione el producto a comprar:</b>

<select size="1" id="Productos" name="Productos" onChange = "javascript:sublist(this.form, Productos.value);">
<option selected>Selecciona un Producto</option>
<%productos_Sql = "Select distinct id, productos from productos ORDER BY Productos"
rs.Open productos_Sql, Conn
do while not rs.eof%>
<option value="<%=rs("id")%>"><%=rs("productos")%></option>
<%rs.movenext
loop%>
</select>
<input type="text" name="T2" size="20"><p align="center">
<table border="1" align="center" width="42%">
  <tr>
    <td width="23%" align="left"><b>Productos</b></td>
    <td width="77%" align="left">

<SELECT id="subcatagory" name="subcatagory" size="1" onChange = "javascript:sublist(precio.value = this.value);">
	<Option selected value="none"></option>
</SELECT>
    </td>
  </tr>
  <tr>
    <td width="23%" align="left"><b>Cantidad</b></td>
    <td width="77%" align="left">
    	<input type="text" name="Cantidad" size="10" onkeypress="return numero(event,this.value)"></td>
  </tr>
  <tr>
    <td width="23%" align="left">
      <b>Precio</b>
    </td>
    <td width="77%" align="left">
	    <input type="text" name="precio" size="10" disabled value="">
    </td>
  </tr>
  <tr>
    <td width="23%" align="left">
    <input type="button" value="Ver Sub-Total" name="B1" ONCLICK="return multiplica()"></td>
    <td width="77%" align="left">
	    <input type="text" name="T1" size="10" disabled>
    </td>
  </tr>
</table>

<p align="center">
<input type="submit" value="Comprar" name="B2" ONCLICK="return comprar()">

<%set rs=nothing
conn.close
set conn=nothing%>
</Form></body>
Funciones.asp
Código:
<script language = "JavaScript">
<% 'CONSULTA PARA OBTENER LOS DATOS
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open("DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("./Ventas2.mdb"))

productos_Sql = "Select * from precios ORDER BY id2"
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("tipo_producto"))%>";
subcatagoryof = "<%=(rs("Id"))%>";
subcatagoryid = "<%=(rs("precios"))%>";
subcat[x,0] = subcatagorys;
subcat[x,1] = subcatagoryof;
subcat[x,2] = subcatagoryid;

FRMCLIENTE.precio.value= document.FRMCLIENTE.subcatagory.value;
FRMCLIENTE.T2.value= subcatagoryof ;
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
%>
}

function numero(e,txt){
	tecla = (document.all) ? e.keyCode : e.which;
	if (tecla==8) return true;
	if (tecla==46 && txt.indexOf('.') != -1) return false;
	patron = /[\d\.]/;
	te = String.fromCharCode(tecla);
	return patron.test(te);}
	
function multiplica(){

 if (FRMCLIENTE.Productos.value==''){
	alert("Seleccione un producto");
	return false;}

 if (FRMCLIENTE.Cantidad.value==''){
	alert("Ingrese la Cantidad a Comprar");
	return false;}

	cant = document.FRMCLIENTE.Cantidad.value;
	pre = document.FRMCLIENTE.precio.value;
	mul = cant * pre;
	document.FRMCLIENTE.T1.value = (Math.round(mul*100))/100;
	return false;
	}
</script>
saludos.
  #2 (permalink)  
Antiguo 29/09/2006, 03:46
Avatar de trasgukabi  
Fecha de Ingreso: septiembre-2004
Mensajes: 2.749
Antigüedad: 19 años, 8 meses
Puntos: 18
pregunta en el foro de javascript
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 22:25.