Foros del Web » Programando para Internet » PHP »

Obtener una fecha a traves de un onclick

Estas en el tema de Obtener una fecha a traves de un onclick en el foro de PHP en Foros del Web. como puedo obtener la fecha de un calendario de modo procedural mediante un onclick en un radiobutton?...
  #1 (permalink)  
Antiguo 21/09/2010, 13:51
 
Fecha de Ingreso: agosto-2010
Ubicación: Mexico
Mensajes: 180
Antigüedad: 13 años, 8 meses
Puntos: 0
Obtener una fecha a traves de un onclick

como puedo obtener la fecha de un calendario de modo procedural mediante un onclick en un radiobutton?
  #2 (permalink)  
Antiguo 21/09/2010, 14:02
Avatar de AdrianSeg  
Fecha de Ingreso: enero-2010
Mensajes: 595
Antigüedad: 14 años, 3 meses
Puntos: 14
Respuesta: Obtener una fecha a traves de un onclick

Bua no me he enterado de nada, más información? Algun ejemplo?
  #3 (permalink)  
Antiguo 21/09/2010, 14:10
 
Fecha de Ingreso: agosto-2010
Ubicación: Mexico
Mensajes: 180
Antigüedad: 13 años, 8 meses
Puntos: 0
Respuesta: Obtener una fecha a traves de un onclick

Codigo de inputs, calendario y radiobuttons
<?php
$m = isset($_REQUEST['m']) ? $_REQUEST['m'] : 0;

/**
* date('F') -> Una representación textual completa de un mes, como enero o marzo
* date('Y') -> Una representación numérica completa de un año, 4 dígitos
* date('n') -> Representación numérica de un mes, sin ceros a la izquierda
* date('L') -> Si es un año bisiesto
*/

//$id = isset($_GET['vFContrato']);
$arrDate = explode(' ', date('F Y n L', strtotime($m . ' month')));
$lastDayOfMonth = date('d', strtotime('last day of ' . $arrDate[0])) + ($arrDate[2] == 2 ? $arrDate[3] : 0);
$calendar = '';
//echo $lastDayOfMonth;
for($i=1; $i<=$lastDayOfMonth; $i++)
{
$numDayWeek = date('w', mktime(0, 0, 0, (date('n') + $m), $i));
$js = date('d-m-y', mktime(0, 0, 0, (date('n') + $m), $i));
$calendar .= ($numDayWeek == 0 && $i != 1) ? '</tr><tr>' : '';
//echo $js;
$calendar .= ($i == 1 && $numDayWeek > 0)
? "<td colspan='$numDayWeek' class='opac'> </td> <td><a href='#' id='<?php $js; ?>' value='<?php $js; ?>' onClick= obtenFecha(".$js.") >".$i."</a> </td>"
: "<td><a href='#' id='<?php $js; ?>' value='<?php $js; ?>' onClick= obtenFecha(".$js.")>".$i."</a> </td>";
$calendar .= ($i == $lastDayOfMonth && (6 - $numDayWeek) > 0) ? '<td colspan="' . (6 - $numDayWeek) . '" class="opac">' : '';
//echo "<br/>".$i;
//echo $js;
}
?>
...
<TD>
FECHA INICIO<BR/>
<INPUT TYPE="TEXT" NAME="vINICIO" ID="vINICIO" VALUE="<?PHP echo $row[13]; ?>">
&nbsp;&nbsp;<BR/>
PRIMERA RENOVACION DE CONTRATO<BR/>
<INPUT TYPE="TEXT" NAME="vMES" ID="vMES" VALUE="<?PHP echo sumarmeses ($row[13], 1); ?>">
&nbsp;&nbsp;<BR/>
SEGUNDA RENOVACION DE CONTRATO<BR/>
<INPUT TYPE="TEXT" NAME="vTRIO" ID="vTRIO" VALUE="<?PHP echo sumarmeses ($row[13], 4); ?>">
&nbsp;&nbsp;<BR/>
TERCERA RENOVACION DE CONTRATO<BR/>
<INPUT TYPE="TEXT" NAME="vANIO" ID="vANIO" VALUE="<?PHP echo sumarmeses ($row[13], 16); ?>">
&nbsp;&nbsp;
</TD>

<TD><center>
<table>
<tr>
<th colspan="7"><?php echo $arrDate[0]; ?> <?php echo $arrDate[1]; ?></th>
</tr>
<tr>
<th colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo ($m - 12); ?>">&lt;&lt;<?php echo $arrDate[1] - 1 ?></th>
<th></th>
<th colspan="3">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo ($m + 12); ?>"><?php echo $arrDate[1] + 1; ?>&gt;&gt;</a></th>
</tr><tr>
<th>D</th>
<th>L</th>
<th>M</th>
<th>M</th>
<th>J</th>
<th>V</th>
<th>S</th>
</tr><tr>
<?php echo $calendar; ?>
</tr><tr>
<th><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo ($m - 1); ?>">&lt;&lt;</a></th>
<th colspan="5"></th>
<th><a href="<?php echo $_SERVER['PHP_SELF']; ?>?m=<?php echo ($m + 1); ?>">&gt;&gt;</a></th>
</tr>
</table></center>
<label for="vINICIO">
<input type="radio" name="vFContrato" id="vFContrato" /> FECHA INICIAL
<br />
</label>
<label for="vMES">
<input type="radio" name="vFContrato" id="vFContrato" /> PRIMERA RENOVACION
<br />
</label>
<label for="vTRIO">
<input type="radio" name="vFContrato" id="vFContrato" /> SEGUNDA RENOVACION
<br />
</label>
<label for="vANIO">
<input type="radio" name="vFContrato" id="vFContrato" /> TERCERA RENOVACION
<BR />
</label>

Etiquetas: onclick, fechas
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 20:31.