JavaScript - Centrar calendario javascrip

   
Vista:

Centrar calendario javascrip

Publicado por Cristian (1 intervención) el 22/01/2013 15:29:10
Hola en el siguiente form, tengo un boton que me abre un calendario pero me lo habre a la izquierda,
y en la parte superior, mi objetivo es que ese formulario se abra ahi mismo en el centro u al costado del boton que lo abre:
Les dejo mi codigo del formulario:

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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
<?php require_once('Connections/cn.php'); ?>
<?php
error_reporting(E_ALL ^ E_NOTICE);
//initialize the session
if (!isset($_SESSION)) {
  session_start();
}
 
// ** Logout the current user. **
$logoutAction = $_SERVER['PHP_SELF']."?doLogout=true";
if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){
  $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){
  //to fully log out a visitor we need to clear the session varialbles
  $_SESSION['MM_Username'] = NULL;
  $_SESSION['MM_UserGroup'] = NULL;
  $_SESSION['PrevUrl'] = NULL;
  unset($_SESSION['MM_Username']);
  unset($_SESSION['MM_UserGroup']);
  unset($_SESSION['PrevUrl']);
 
  $logoutGoTo = "index.php";
  if ($logoutGoTo) {
    header("Location: $logoutGoTo");
    exit;
  }
}
?>
<?php
if (!isset($_SESSION)) {
  session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
 
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
  // For security, start by assuming the visitor is NOT authorized. 
  $isValid = False;
 
  // When a visitor has logged into this site, the Session variable MM_Username set equal to their username. 
  // Therefore, we know that a user is NOT logged in if that Session variable is blank. 
  if (!empty($UserName)) {
    // Besides being logged in, you may restrict access to only certain users based on an ID established when they login. 
    // Parse the strings into arrays. 
    $arrUsers = Explode(",", $strUsers);
    $arrGroups = Explode(",", $strGroups);
    if (in_array($UserName, $arrUsers)) {
      $isValid = true;
    }
    // Or, you may restrict access to only certain users based on their username. 
    if (in_array($UserGroup, $arrGroups)) {
      $isValid = true;
    }
    if (($strUsers == "") && true) {
      $isValid = true;
    }
  }
  return $isValid;
}
 
$MM_restrictGoTo = "error.html";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
  $MM_qsChar = "?";
  $MM_referrer = $_SERVER['PHP_SELF'];
  if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
  if (isset($QUERY_STRING) && strlen($QUERY_STRING) > 0)
  $MM_referrer .= "?" . $QUERY_STRING;
  $MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
  header("Location: ". $MM_restrictGoTo);
  exit;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
 
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
 
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
 
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
 
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  //$fecInicio = $_POST['dia']."-".$_POST['mes']."-".$_POST['ano'];
    $insertSQL = sprintf("INSERT INTO agenda (desAsunto, desLugar,fecInicio, horaInicio, horaFin, codPersonal, desObservaciones, fechaingreso) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['desAsunto'], "text"),
                       GetSQLValueString($_POST['desLugar'], "text"),
					   GetSQLValueString($_POST['fecha'],"text"),
                       GetSQLValueString($_POST['horaInicio'], "text"),
                       GetSQLValueString($_POST['horaFin'], "text"),
                       GetSQLValueString($_POST['codPersonal'], "text"),
                       GetSQLValueString($_POST['desObservaciones'], "text"),
					   GetSQLValueString($_POST['txtFechaIngreso'], "text"));
  mysql_select_db($database_cn, $cn);
  $Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());
  $ultimo_id = mysql_insert_id();
 
  if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO movilidad (codReunion, movMonto, movEstado) VALUES ($ultimo_id, %s, %s)",
                     //  GetSQLValueString($_POST['codReunion'], "int"),
                       GetSQLValueString($_POST['movMonto'], "double"),
                       GetSQLValueString($_POST['movEstado'], "text"));
 
 
  mysql_select_db($database_cn, $cn);
  $Result1 = mysql_query($insertSQL, $cn) or die(mysql_error());
}
 
  $insertGoTo = "principal.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}
 
$colname_rsUsuario = "-1";
if (isset($_SESSION['MM_Username'])) {
  $colname_rsUsuario = $_SESSION['MM_Username'];
}
mysql_select_db($database_cn, $cn);
$query_rsUsuario = sprintf("SELECT * FROM personal WHERE nomUsuario = %s", GetSQLValueString($colname_rsUsuario, "text"));
$rsUsuario = mysql_query($query_rsUsuario, $cn) or die(mysql_error());
$row_rsUsuario = mysql_fetch_assoc($rsUsuario);
$totalRows_rsUsuario = mysql_num_rows($rsUsuario);
 
mysql_select_db($database_cn, $cn);
$query_rsMovilidad = "SELECT * FROM movilidad";
$rsMovilidad = mysql_query($query_rsMovilidad, $cn) or die(mysql_error());
$row_rsMovilidad = mysql_fetch_assoc($rsMovilidad);
$totalRows_rsMovilidad = mysql_num_rows($rsMovilidad);
?><!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 rel="shortcut icon" href="images/agenda.ico">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 
	<script language="javascript" src="js/jquery-1.3.min.js"></script>
	<script language="javascript">
		function checkFields() {
			missinginfo = "";
			if (document.form1.desAsunto.value == "") {
				missinginfo += "\n     -  Asunto";
			}
			if (document.form1.desLugar.value == "") {
				missinginfo += "\n     -  Lugar";
			}
			if (document.form1.fecha.value == "") {
				missinginfo += "\n     -  Fecha";
			}
			if (missinginfo != "") {
				missinginfo ="________________________________________\n" +
				"Completa los siguientes datos:\n" +
				missinginfo + "\n________________________________________" +
				"\n¡Pulsa enter, rellena los datos e intenta de nuevo!";
				alert(missinginfo);
				return false;
			}
			else return true;
			}
	</script>
 
	<SCRIPT LANGUAGE="JavaScript">
		function changeCase(frmObj) {
			var index;
			var tmpStr;
			var tmpChar;
			var preString;
			var postString;
			var strlen;
			tmpStr = frmObj.value.toLowerCase();
			strLen = tmpStr.length;
			if (strLen > 0)  {
				for (index = 0; index < strLen; index++)  {
					if (index == 0)  {
						tmpChar = tmpStr.substring(0,1).toUpperCase();
						postString = tmpStr.substring(1,strLen);
						tmpStr = tmpChar + postString;
					}
			else {
				tmpChar = tmpStr.substring(index, index+1);
					if (tmpChar == " " && index < (strLen-1))  {
						tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
						preString = tmpStr.substring(0, index+1);
						postString = tmpStr.substring(index+2,strLen);
						tmpStr = preString + tmpChar + postString;
	    		     }
      			}
			   }
			}
			frmObj.value = tmpStr;
			}
	</script>
 
<title>Registro de Reuniones</title>
 
</head>
 
<body>
  <table width="1003" border="0" cellspacing="0" align="center">
 
    <tr>
      <td height="102" colspan="10" valign="bottom" background="images/banner.png" bgcolor="#336699">&nbsp;</td>
    </tr>
 
    <tr height="22" valign="middle">
      <td colspan="6" bgcolor="#336699" class="white" align="right">Bienvenido</td>
      <td colspan="4" bgcolor="#336699" class="user" align="left"><?php echo $row_rsUsuario['nomPersonal'];?></td>
    </tr>
 
    <tr height="22" valign="middle">
      <td width="204" bgcolor="#7996B1"> </td>
      <td width="3" bgcolor="#B4C6DB"> </td>
      <td width="25" bgcolor="#B4C6DB" align="center">
      	<a href="principal.php"><img src="images/application_home.png" width="18" height="18" border="0" title="Página de Inicio"/></a></td>
      <td width="25" bgcolor="#B4C6DB" align="center">
      	<a href="javascript:history.go(-1)"><img src="images/arrow_left.png" width="18" height="18" border="0" title="Página Anterior"/></a></td>
      <td width="25" bgcolor="#B4C6DB" align="center">
      	<a href="javascript:history.go(+1)"><img src="images/arrow_right.png" width="18" height="18" border="0" title="Página Siguiente"/></a></td>
      <td width="450" bgcolor="#B4C6DB" align="center" class="fuente">
	    <script type="text/javascript"> document.write (fecha);
	  </script></td>
      <td width="16" bgcolor="#B4C6DB" align="center">
      	<a href="cuenta.php"><img src="images/application_key.png" width="16" height="16" border="0"/></a></td>
      <td width="100" bgcolor="#B4C6DB" align="left" class="fuente"><a href="cuenta.php">Mi Cuenta</a></td>
      <td width="16" bgcolor="#B4C6DB" align="center">
      	<a href="<?php echo $logoutAction ?>"><img src="images/cross_octagon.png" width="16" height="16" border="0"/></a></td>
      <td width="119" bgcolor="#B4C6DB" align="left" class="fuente"><a href="<?php echo $logoutAction ?>">Cerrar Sesión</a></td>
    </tr>
 
    <tr>
      <td height="320" rowspan="2" align="center" valign="top" bgcolor="#B4C6DB"><p>&nbsp;</p>      </td>
      <td height="18" bgcolor="#F8F8F8">&nbsp;</td>
      <td height="18" colspan="8" bgcolor="#F8F8F8">&nbsp;</td>
    </tr>
    <tr>
      <td height="313" valign="top" bgcolor="#F7F7F7">&nbsp;</td>
      <td height="313" colspan="8" valign="top" bgcolor="#F7F7F7"><form action="<?php echo $editFormAction; ?>" method="post" name="form1" id="form1" onsubmit="return checkFields();" >
        <table width="528" height="372" align="center">
          <tr valign="middle" height="30">
            <td width="120" align="right" nowrap="nowrap" class="fuente">Asunto:</td>
            <td colspan="2" align="left"><input type="text" name="desAsunto" value="" size="50" onkeypress="javascript:changeCase(this.form1.desAsunto) "/></td>
          </tr>
 
          <tr valign="middle" height="30">
            <td align="right" nowrap="nowrap" class="fuente">Lugar:</td>
            <td colspan="2" align="left"> <input type="text" name="desLugar" value="" size="50" /></td>
          </tr>
 
          <tr valign="middle" height="30">
            <td align="right" nowrap="nowrap" class="fuente">Fecha:</td>
            <td width="95" align="left"> <input name="fecha" type="text" id="fecha" size="15" readonly="readonly" /></td>
            <td width="297" align="left"><img src="images/cal.gif" width="16" height="16" align="middle" onclick="popUpCalendar(this, form1.fecha, 'yyyy-mm-dd')"/></td>
          </tr>
 
		  <tr valign="middle" height="30">
            <td align="right" nowrap="nowrap" class="fuente">Fecha registro :</td>
            <td colspan="2" align="left"> <input name="txtFechaIngreso" type="text"  id="txtFechaIngreso" value="<?php echo date('Y-m-d')?>" size="50" readonly="readonly" /></td>
          </tr>
 
           <tr valign="middle" height="30">
            <td align="right" nowrap="nowrap" class="fuente">Hora Inicio:</td>
            <td colspan="2" align="left"><select name="horaInicio" id="horaInicio">
 
          </tr>
 
          <tr valign="middle" height="30">
            <td align="right" nowrap="nowrap" class="fuente">Hora Fin:</td>
 
                <input name="codPersonal" type="hidden" id="codPersonal" value="<?php echo $row_rsUsuario['codPersonal']; ?>" />
			</td>
          </tr>
 
          <tr>
            <td height="114" align="right" valign="top" nowrap="nowrap" class="fuente">Detalle Reunión:</td>
            <td colspan="2" align="left"><textarea name="desObservaciones" cols="38" rows="10"></textarea><label></label></td>
          </tr>
 
          <tr height="30" valign="middle">
            <td align="right" nowrap="nowrap"> </td>
            <td colspan="2" align="left"><input type="submit" name="submit" value="Insertar registro" /></td>
          </tr>
        </table>
 
        <p>
          <input type="hidden" name="MM_insert" value="form1" /></p>
 
        <table align="center">
          <tr valign="baseline">
            <td nowrap="nowrap" align="right"><input name="movMonto" type="hidden" id="movMonto" value="0.00" /></td>
            <td><input name="movEstado" type="hidden" id="movEstado" value="-" /></td>
          </tr>
        </table>
      </form></td>
    </tr>
    <tr>
      <td colspan="10" bgcolor="#336699" align="center" class="white">2012</td>
    </tr>
  </table>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($rsUsuario);
 
mysql_free_result($rsMovilidad);
?>


como puedo hacer que se centre el calendario y no se vaya por la izquierda y superior.
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