Foros del Web » Programando para Internet » Javascript »

Target de un formulario en Div

Estas en el tema de Target de un formulario en Div en el foro de Javascript en Foros del Web. Hola muy buenas, tengo un problema con unos formularios y unos divs... Soy un poko novato con el tema de la maquetacion CSS me he ...
  #1 (permalink)  
Antiguo 26/09/2011, 17:00
 
Fecha de Ingreso: noviembre-2010
Ubicación: Lepe
Mensajes: 23
Antigüedad: 13 años, 5 meses
Puntos: 0
Target de un formulario en Div

Hola muy buenas, tengo un problema con unos formularios y unos divs...

Soy un poko novato con el tema de la maquetacion CSS me he leido el manual de la web y he seguido los pasos necesarios para tener lo que os enseño aquí
Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head><link href="indice2.css" rel="stylesheet" type="text/css" />
<script src="script/java.js" type="text/javascript"></script>
<script language='javascript' type="text/javascript" src="script/popcalendar.js"></script>


<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Administracion</title>
<style type="text/css">
.auto-style1 {
	font-size: xx-large;
}
</style>
</head>

<body>
<center>
<p class="auto-style1"><strong>Administración</strong></p>
</center>

<div id="administracion"style="clear:both;">
<div id="menu"> 
<table><tr>
<td class="menu"><a href="javascript:loadoneurl('adddog.php', 'centro')">Añadir Perro</a></td>
</tr>
<tr>
<td class="menu"><a href="javascript:loadoneurl('editdog.php', 'centro')">Editar Perro</a></td>
</tr>
<tr>
<td class="menu"><a href="javascript:loadoneurl('editlocate.php', 'centro')">Localización</a></td>
</tr>
<tr>
<td class="menu"><a href="javascript:loadoneurl('editcontact.php', 'centro')">Contacto</a></td>
</tr>
<tr>
<td class="menu"><a href="logout.php">Salir</a></td></tr>
</table>
</div>


<div id="centro">

</div>
</div>
</body>

</html> 
y dentro de ese div con ID #centro
se carga este script al pulsar el boton de añadir perro.

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link href="indice2.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language='javascript' src="script/popcalendar.js"></script>

</head>

<body>
<div id="formulario">
<form name="Formulario" method="post"  target="centro" action='adddog2.php' enctype='multipart/form-data'>
<div>
<div style="float:left; width:150px;">Nombre&nbsp;&nbsp; </div>
	<div style="float:left;"><input type="text" name="Nombre" size="25" maxlength="50" /></div>
</div>
<div style="clear:both;">
<div style="float:left; width:150px;">Madre</div>
	<div style="float:left;"><input type="text" name="Madre" size="25" maxlength="50" /></div>
</div>
<div style="clear:both;">
<div style="float:left; width:150px;">Padre</div>
	<div style="float:left;"><input type="text" name="Padre" size="25" maxlength="50" /></div>
</div>

<div style="clear:both;">
<div style="float:left; width:150px;">Raza</div>
	<div style="float:left;">
		<select name="Raza" style="width:170px;">
			<option selected="selected" value="Pelo Largo">Pelo Largo</option>
			<option  value="Pelo Corto">Pelo Corto</option>
		</select>
	</div>
</div>


<div style="clear:both;">
<div style="float:left; width:150px;">Sexo</div>
	<div style="float:left;">
		<select name="Sexo" style="width:170px;">
			<option selected="selected" value="Macho">Macho</option>
			<option  value="Hembra">Hembra</option>
		</select>
	</div>
</div>


<div style="clear:both;">
<div style="float:left; width:150px;">Estado</div>
	<div style="float:left;">
		<select name="Estado" style="width:170px;">
			<option selected="selected" value="Propio">Propio</option>
			<option  value="Reservado">Reservado</option>
			<option  value="Vendido">Vendido</option>
			<option  value="Disponible">Disponible</option>
		</select>
	</div>
</div>

<div style="clear:both;">
<div style="float:left; width:150px;">Fecha de nacimiento</div>
	<div style="float:left;">
		<input name="Nacimiento" type="text" id="dateArrival" onclick="popUpCalendar(this, Formulario.dateArrival, 'yyyy-mm-dd');" size="25"/>
	</div>
</div>

<div style="clear:both;">
<div style="float:left; width:150px;">Foto</div>
	<div style="float:left;"><input type="file" name="foto" size="11" maxlength="50" /></div>
</div>


<div style="clear:both;">
<div style="float:left; width:150px;"></div>
	<div style="float:left;">
	  <input type="submit" value="Enviar" name="enviado" size="25"/>

	</div>
</div>

</form>
</div>

</body>

</html> 



Y ahora lo que necesito es que al yo pulsar ese Submit, no me recargue la web entera sino que solo me recargue el Div centro, que el menú lateral se quede ahí.


A ver quien me puede hechar una manita y que no sea al cuello.

Muchar gracias ;)
  #2 (permalink)  
Antiguo 26/09/2011, 17:08
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Target de un formulario en Div

Por favor, procura realizar tus preguntas en el lugar correspondiente.

PHP se ejecuta en el servidor, y lo que necesitas se realiza en el cliente, en el navegador.

La tecnología que debes emplear se le conoce como Ajax, para que no te pierdas se trata de Javascript y no de PHP.

El target natural de los formularios y enlaces solo responde a ventanas externas o iframes, no a divs.

He reportado tu tema para que lo muevan a donde corresponde.
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 26/09/2011, 17:09
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Target de un formulario en Div

Debes usar AJAX para realizar lo que deseas. Pasa por el foro indicado para que te den mejor ayuda (Javascript) o busca información al respecto en el internet
  #4 (permalink)  
Antiguo 26/09/2011, 18:06
 
Fecha de Ingreso: noviembre-2010
Ubicación: Lepe
Mensajes: 23
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: Target de un formulario en Div

Muchisimas gracias pateketrueke, es ke en principio tenis los Script HTML en PHP con echos, pero los quite y se me olvidó... jajaja lo siento, de todas formas lo que dices, si es Javascript pues para allá nos vamos a investigar cosillas nuevas, que nunca están de más :D

Gracias a los 2. A ver si me ayudan por el otro foro ;)
  #5 (permalink)  
Antiguo 27/09/2011, 08:25
 
Fecha de Ingreso: noviembre-2010
Ubicación: Lepe
Mensajes: 23
Antigüedad: 13 años, 5 meses
Puntos: 0
Respuesta: Target de un formulario en Div

Nadie sabe decirme nda por aki??

Etiquetas: formulario, html, target
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 08:31.