1
C, C++, C#, Java, Visual Basic, HTML, PHP, CSS, Javascript, Ajax, Joomla, MySql y más / No funciona condicional para funcion envio validar formulario JavaScript
« en: 30 de Diciembre 2015, 17:51 »
Si selecciono 1 pagina en modo urgente me indica que mi saldo no es suficiente y obviamente le puse bastante mas para que no ocurra, agradecido de antemano a posibles soluciones
Código: [Seleccionar]
<html>
<head>
<title>..::Solicitud de Impresion::.. </title>
<meta name="viewport" content="width=device-width"/>
<script type="text/javascript">
function enviar()
{
var envio = "355";
if (document.impresion.total.value==""){
document.impresion.total.value < 0;}
if (document.impresion.total.value > envio )
{
if (document.impresion.total.value < document.impresion.saldo.value)
{alert("Su saldo debe ser mayor o igual al total para poder solicitar impresion");}
else
{document.forms["impresion"].submit();}
}
else
{alert("Debe al menos solicitar una impresion");}
}
function precios()
{
if (document.impresion.tipo[0].checked == true ){
document.impresion.precio.value = "60";
}else{document.impresion.precio.value = "35";}
totales();
}
function totales()
{
if (document.impresion.precio.value==""){
document.impresion.precio.value = 0;}
if (document.impresion.cantidad.value==""){
document.impresion.cantidad.value = 0;}
var prec = parseInt(document.impresion.precio.value);
var cant = parseInt(document.impresion.cantidad.value);
var env = "355";
var total1= (prec*cant);
var cond = 3*env;
if (total1>(cond)){
var total2= (prec*cant);}
else{
var total2= (prec*cant)+parseInt(env);}
document.impresion.total.value = total2;
if (document.impresion.total.value=="NaN"){
document.impresion.total.value = 0;}
}
</script>
</head>
<body>
<table width="device-width" align="center">
<form name='impresion' id='impresion' method='post' action='impresion2.php' target='_self' enctype="multipart/form-data">
<tr><td rowspan="3" align="center" valign="middle"><b><font size="4">Imprimir</b></font><br><font size="2">Centro de soluciones</font></td>
<td align="left" valign="middle"><font size="2"><b>Nombre:</b> <? echo $ro_a['nombre']; ?></font></td><td rowspan="3" align="center" valign="middle"><b>Saldo:</b> Bs.<input type="text" size="5" id="saldo" name="saldo" value="5000" disabled></td>
</tr>
<tr><td align="left" valign="middle"><font size="2"><b>Cedula:</b> <? echo $ro_a['cedula']; ?></font></td></tr>
<tr><td align="left" valign="middle"><font size="2"><b>Correo:</b> <? echo $ro_a['correo']; ?></font></td></tr>
<tr><td colspan="3" align="center" valign="middle"><hr></td></tr>
<tr><td colspan="3" align="center" valign="middle">
<table width="100%" align="center">
<tr>
<td align="center" valign="middle" height="40" width="100%"><input type='radio' name='tipo' id='tipo' value='Impresion Urgente 24 horas' OnClick="precios();" required> Impresion Urgente 24 Horas Bs.60 por pagina<br><input type='radio' name='tipo' id='tipo' value='Impresion Normal 3 dias' OnClick="precios();" > Solicitud Normal 3 dias Bs.35 por pagina</td>
</tr>
<tr>
<td align="center" valign="middle" height="40" width="100%"><input type='radio' name='envio' id='envio' value='MRW' required checked> MRW<br><input type='radio' name='envio' id='envio' value='Tealca' required> Tealca<br><input type='radio' name='envio' id='envio' value='Zoom' required> ZOOM</td>
</tr>
<tr>
<td align="center" valign="middle" height="40" width="100%" >
Cantidad: <input type="number" id="cantidad" min="1" max="500" name="cantidad" maxlength="2" required OnChange="totales();" > Precio: Bs.<input type="text" name="precio" id="precio" size="4" disabled > Total: Bs.<input type="text" name="total" id="total" size="5" value="355" disabled>
</td>
</tr>
<tr>
<td align="center" valign="middle" height="40" width="100%"><input type='button' value='Enviar Solicitud' OnClick="enviar();"> <input type='reset' value='Borrar Todo'> <a href="ppal.php"><input type="button" value="Volver al inicio"></a>
</td>
</tr>
</table>
</form></td></tr>
<tr><td colspan="3"><hr></td></tr>
</table>
</body>
</html>