Dreamweaver - Ayuda por favor. es urgrente

 
Vista:

Ayuda por favor. es urgrente

Publicado por yessica (1 intervención) el 16/05/2013 02:05:44
Hola buenas tarde estoy haciendo un formulario dinámico , ya lo tengo pero necesito como hacer una función javascript para agregar filas en tabla y luego como hacer la interacción con php. tengo el scipt pero como lo adapto al formulario que estoy haciendo.
mi formulario:

datos.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
 
<script language="JavaScript" type="text/javascript" src="../funcion.js"></script>
 
 
<title>uno x diez</title>
<style type="text/css">
<!--
.Estilo17 {
font-size: 24px;
font-weight: bold;
color: #000066;
}
.Estilo18 {color: #FFFFFF}
.Estilo19 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
}
-->
</style>
</head>
<body>
 
<center>
 
<tr>
<td><table width="171" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="108"><div align="center">
<h1 class="Estilo19">PATRULLEROS</h1>
</div></td>
</tr>
</table></td>
<td><p> </p>
<p> </p></td>
</tr>
 
<table width="600" height="50" border="1" cellpadding="1" cellspacing="3">
<tr bgcolor="#C0C0C0">
<td height="50" colspan="8"><div class="msj1 Estilo18" id="error">
<div align="center" class="Estilo17">Ingresar Datos</div>
</div></td>
</tr>
<tr>
<td width="144"><div align="center"></div></td>
<td width="144"><div align="center">Cedula</div></td>
<td width="144"><div align="center">Nombre</div></td>
<td width="144"><div align="center">Apellido</div></td>
<td width="144"><div align="center">Direccion</div></td>
<td width="144"><div align="center">Telefono</div></td>
<td width="146"><div align="center">Centro de Votacion </div></td>
</tr>
<tr>
<td><form id="habitante" name="habitante" method="post" action="guardar_datos.php">
<div align="center">
<input name="textarea" type="text" value="" />
</div>
</form> </td>
<td><div align="center">
<input name="cedula" type="text" id="cedula" value="" />
</div></td>
<td><div align="center">
<input name="nombre" type="text" id="nombre" value="" />
</div></td>
<td><form id="form2" name="form2" method="post" action="">
<div align="center">
<input name="apellido" type="text" id="apellido" value="" />
</div>
</form> </td>
<td><form id="direccion" name="direccion" method="post" action="">
<div align="center">
<input name="direccion" type="text" id="direccion" value="" />
</div>
</form> </td>
<td><form id="form4" name="form4" method="post" action="">
<div align="center">
<input name="telefono" type="text" id="telefono" value="" />
</div>
</form> </td>
<td><form id="form5" name="form5" method="post" action="">
<div align="center">
<input name="sede" type="text" id="sede" value="" />
</div>
</form> </td>
</tr>
</table>
 
</center>
 
</form>
 
</body>
</html>
<?php
 
?>


aquí tengo el scipt pero como lo adapto al formulario que estoy haciendo?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<html>
head>
<script language="JavaScript">
var i=2;
function A()
{
var t=document.getElementById('cont').innerHTML;
t=t.substring(0,(t.length-8));
t+="<tr><td>"+i+",1</td><td>"+i+",2</td><td>"+i+",3</td></tr></table>";
document.getElementById('cont').innerHTML=t;
i++;
}
function B()
{
var t=document.getElementById('cont').innerHTML;
var j=t.lastIndexOf("<tbody>");
t=t.substring(0,j);
t+="</table>";
document.getElementById('cont').innerHTML=t;
}
</script></head><body>
<input type="button" name="af" value="Añadir fila" onClick="A();">
<input type="button" name="af" value="Borrar fila" onClick="B();">
<div id="cont">
<table id="t" border="1" width="100%">
<tr><td>1,1</td><td>1,2</td><td>1,3</td></tr>
</table></div>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder