Ver Mensaje Individual
  #12 (permalink)  
Antiguo 14/02/2008, 09:06
ARAPSPGON
 
Fecha de Ingreso: octubre-2007
Mensajes: 57
Antigüedad: 17 años, 7 meses
Puntos: 0
Re: (DUDA principiante) importar resultados de una pagina ASP en una pag html

ahora lo que me falta poner es que muestre un mensaje por ejemplo "introduzca valor numerico" en el caso que en la casilla de introduccion "cantidad" no se haya introducido nada .

he probado con esto

Código PHP:
<%
if 
request.ServerVariables("REQUEST_METHOD")="POST" then
    origen 
request.Form("origen")
    
destino request.Form("destino")
    
cantidad request.Form("cantidad")
    
    
select case origen
        
case 1 respuesta1 "Tus " cantidad " Euros equivalen a "
        
case 2 respuesta1 "Tus " cantidad " Pesetas equivalen a "
        
case 3 respuesta1 "Tus " cantidad " Dolares equivalen a "
    
end select
    
if origen=and destino=1 then
        total
=cdbl(cantidad)*1
        
else
            if 
origen=and destino=2 then
                total
=cdbl(cantidad)*166.39
            
else
                if 
origen=and destino=3 then
                    total
=cdbl(cantidad)*1.46
                
else
                    if 
origen=and destino=1 then 
                        total
=cdbl(cantidad)*0.006
                        
else
                            if 
origen=and destino=2 then 
                                total
=cdbl(cantidad)*1
                            
else
                                if 
origen=and destino=3 then 
                                    total
=cdbl(cantidad)*0.008
                                
else
                                         if 
origen=and destino=1 then 
                             total
=cdbl(cantidad)*0.68
                                         
else
                                          if 
origen=and destino=2 then 
                                               total
=cdbl(cantidad)*114.1
                                
else
                                        if 
origen=and destino=3 then 
                                            total
=cdbl(cantidad)*1

                                    end 
if
                                
end if
                            
end if
                        
end if
                    
end if
                
end if
            
end if
        
end if
    
end if
     
select case destino
        
case 1 respuesta2 total " Euros"
        
case 2 respuesta2 total " Pesetas"
        
case 3 respuesta2 total " Dolares"
    
end select

    response
.Write respuesta1 respuesta2

if cantidad "" then
    response
.write("Introduzca valor numerico")
end if

end if
    %> 

pero me da error
VBScript en tiempo de ejecución (0x800A000D)
No coinciden los tipos: 'cdbl' linea 74

lo he probado de varias maneras pero al final me ha salido de esta manera
ahora ya funciona perfectamente incluso sin introducir nada o dejando las dos opciones iguales


Código PHP:
<html>
<
head>
<
title>Conversor</title>
</
head>
<
body bgcolor="#CCCC66">

<
center>
<
b><u>
<
font color="#000066" size="+2" face="Arial, Helvetica, sans-serif">
CAMBIO DE MONEDA
</font>
</
u></b>
</
center><br>

<
FORM action="/scripts/ejemplos/conversor.asp" method="POST">
<
table width="543" height="58" border="0" align="center">
  <
tr>
    <
td width="267"><b>
    <
div align="rigth"><font color="#0000CC" size="-1" face="Arial, Helvetica, sans-serif">Moneda Origen</font> &nbsp;</div></b></td>
    <
td width="266"><b>
    <
div align="rigth"><font color="#0000CC" size="-1" face="Arial, Helvetica, sans-serif">Moneda Destino</font>&nbsp;</div></b></td>
  </
tr>
  <
tr>
    <
td>
    <
div align="rigth">
    <
select name="origen" size="1">
    <
option value="1" selected="selected"EUROS </option>
    <
option value="2" PESETAS </option>  
    <
option value="3" DOLARES </option>
    &
nbsp;</select></div></td>
    <
td>
    <
div align="rigth">
    <
select name="destino" size="1">
    <
option value="1" EUROS </option>
    <
option value="2" selected="selected"PESETAS </option>  
    <
option value="3" DOLARES </option>
    &
nbsp;</select></div></td>
  </
tr>
</
table>

<
table width="543" height="58" border="0" align="center">
  <
tr>
    <
td width="169"><b>
    <
div align="rigth"><font color="#0000CC" size="-1" face="Arial, Helvetica, sans-serif">INTRODUZCA CANTIDAD</font> &nbsp;</div></b></td>
    <
td width="366"><b>
    <
div align="rigth"><font color="#0000CC" size="-1" face="Arial, Helvetica, sans-serif">AL CAMBIO:</font>&nbsp;</div></b></td>
  </
tr>
  <
tr>
    <
td>
    <
div align="rigth">
    <
input type="text" name="cantidad" size="20">
    &
nbsp;</div>
    </
td>
    <
td bgcolor="#FFFFFF">
    <
div align="rigth">
    <
b>
    <
font color="#FF0000" size="-1" face="Arial, Helvetica, sans-serif">
    <%
if 
request.ServerVariables("REQUEST_METHOD")="POST" then
    origen 
request.Form("origen")
    
destino request.Form("destino")
    
cantidad request.Form("cantidad")
    
    
select case origen
        
case 1 respuesta1 "Tus " cantidad " Euros equivalen a "
        
case 2 respuesta1 "Tus " cantidad " Pesetas equivalen a "
        
case 3 respuesta1 "Tus " cantidad " Dolares equivalen a "
    
end select
     select 
case destino
        
case ' Euros
        case 2 ' 
Pesetas
        
case 3  Dolares
    end select
    
if origen=and destino=1 then
        
if cantidad "" then
            response
.write("Introduzca valor numerico")
        else
            
total=cdbl(cantidad)*1
            response
.Write respuesta1 total " Euros"
        
end if
        else
            if 
origen=and destino=2 then
                
if cantidad "" then
                    response
.write("Introduzca valor numerico")
                else
                    
total=cdbl(cantidad)*166.39
                    response
.Write respuesta1 total " Pesetas"
                
end if
            else
                if 
origen=and destino=3 then
                    
if cantidad "" then
                    response
.write("Introduzca valor numerico")
                    else
                    
total=cdbl(cantidad)*1.46
                    response
.Write respuesta1 total " Dólares"
                    
end if
                else
                    if 
origen=and destino=1 then
                        
if cantidad "" then
                        response
.write("Introduzca valor numerico")
                        else 
                        
total=cdbl(cantidad)*0.006
                        response
.Write respuesta1 total " Euros"
                        
end if
                    else
                            if 
origen=and destino=2 then 
                                
if cantidad "" then
                                response
.write("Introduzca valor numerico")
                                else 
                                
total=cdbl(cantidad)*1
                                response
.Write respuesta1 total " Pesetas"
                                
end if
                            else
                                if 
origen=and destino=3 then 
                                    
if cantidad "" then
                                    response
.write("Introduzca valor numerico")
                                    else
                                    
total=cdbl(cantidad)*0.008
                                    response
.Write respuesta1 total " Dólares"
                                    
end if
                                else
                                    if 
origen=and destino=1 then
                                        
if cantidad "" then
                                        response
.write("Introduzca valor numerico")
                                        else 
                                        
total=cdbl(cantidad)*0.68
                                        response
.Write respuesta1 total " Euros"
                                        
end if
                                    else
                                        if 
origen=and destino=2 then 
                                            
if cantidad "" then
                                            response
.write("Introduzca valor numerico")
                                            else 
                                            
total=cdbl(cantidad)*114.1
                                            response
.Write respuesta1 total " Pesetas"
                                            
end if
                                        else
                                        if 
origen=and destino=3 then
                                            
if cantidad "" then
                                            response
.write("Introduzca valor numerico")
                                            else  
                                            
total=cdbl(cantidad)*1
                                            response
.Write respuesta1 total " Dólares"
                                            
end if

                                    
end if
                                
end if
                            
end if
                        
end if
                    
end if
                
end if
            
end if
        
end if
    
end if
    
end if
    %>
    </
font>
    </
b>
    &
nbsp;</div>
    </
td>
  </
tr>
</
table>

<
br><br><div align="center"><input type="submit" value="CONVERTIR"></div>
</
FORM>

<
table width="251" height="58" border="0" align="center">
  <
tr>
    <
td width="266"><b>
    <
div align="center"><font color="#FF0000" size="-1" face="Arial, Helvetica, sans-serif">
    <%
if 
request.ServerVariables("REQUEST_METHOD")="POST" then
    origen 
request.Form("origen")
    
destino request.Form("destino")
    
    if 
origen=and destino=1 then
        response
.write("Su conversión no tiene sentido")
        else
            if 
origen=and destino=2 then
                response
.Write("1 Euro equivale a 166.39 Pesetas")
            else
                if 
origen=and destino=3 then
                    response
.write("1 Euro equivale a 1.46 Dólares")
                else
                    if 
origen=and destino=1 then 
                        response
.write("1 Peseta equivale a 0.006 Euros")
                        else
                            if 
origen=and destino=2 then 
                                response
.write("Su conversión no tiene sentido")
                            else
                                if 
origen=and destino=3 then 
                                    response
.write("1 Peseta equivale a 0.008 Dólares")
                                else
                                    if 
origen=and destino=1 then 
                                        response
.write("1 Dólar equivale a 0.68 Euros")
                                    else
                                        if 
origen=and destino=2 then 
                                            response
.write("1 Dólar equivale a 114.1 Pesetas")
                                        else
                                        if 
origen=and destino=3 then 
                                            response
.write("Su conversión no tiene sentido")
                                    
end if
                                
end if
                            
end if
                        
end if
                    
end if
                
end if
            
end if
        
end if
    
end if
    
    
     
end if
    %>
    </
font>&nbsp;</div></b></td>
  </
tr>
</
table>

<
br><br><b><div align="center"><font color="#FF0000" size="-1" face="Arial, Helvetica, sans-serif">Fecha: <% response.write date()%></font></div></b>

</
body>
</
html
en el case 3 de destino falta un ' antes de Dolares

grcias Shiryu_Libra por tu ayuda

ya solo quedaria ponerle alguna foto d fondo y ponerlo mas vistoso pero para eso no hay problema

Última edición por ARAPSPGON; 14/02/2008 a las 09:50