Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/06/2012, 03:42
rufus
 
Fecha de Ingreso: mayo-2009
Ubicación: Andalucia
Mensajes: 650
Antigüedad: 15 años
Puntos: 1
problema con formulario con javasript

Hola


que tengo un formulario y codigo javascript. el boton del formulario no puede ser del tipo submit sino por ejemplo un enlace <a> con el evento onclick para ejecutar la funcion respuesta de javascript pero no me funciona.

soy muy novato en javascript. haber si alguno/a me podeis ayudar.

Código:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    
    	<script Xlanguage="JavaScript">
function pregunta(){
if (confirm('¿Estas seguro de enviar este formulario?')){
document.formulario.submit() 
}
</script>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>formulario</title>
    </head>
    <body>

		<form id = 'action-form' action = '../'>
		
		<p><input name="nombre" type="text" class="nombre"/></p>
		<a href="#" onclick = 'return pregunta();'> enviar </a>
		</form>
		
		
    </body>

</html>