ok Aki estan todos los codigos que tilizo para esto
uno newsw.php
Código HTML:
<html>
<body>
<font color="#3366FF">
<br /><br />
<center>
<strong> Nuevo Software </strong>
<br /><br /><br />
<script language="JavaScript">
var nInput;
function calen(n){
var oWnd;
nInput = n;
oWnd = open("calendario.html", "fechas", "location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=180,height=200");
oWnd.focus();
}
function fillDateField(){
with (document.frm)
if (nInput == 1) {
fecha1.value = dateResult.value;
fee1.value = dataResult.value;}
else{
fecha2.value = dateResult.value;
fee2.value = dateResult.value;}
}
function habilita(){
if(document.frm.tli.value!="Freeware"){
document.frm.cl.disabled = false;
document.frm.ne.disabled = false;
}
else{
document.frm.cl.disabled = true;
document.frm.fecha1.disabled = true;
document.frm.fecha2.disabled = true;
document.frm.ne.disabled = true;
}
}
function esInteger(e){
var charCode
if (navigator.appName == "Netscape"){
charCode = e.which
}
else{
charCode = e.keyCode}
if (charCode < 48 || charCode > 57){
alert("Por favor teclee solo números en este campo!");
return false
}
else{
return true}
}
</script>
<font color="#3366FF">
<form name="frm" method="post" action="newswa.php">
<table width="600" border="0">
<tr>
<td>Nombre:</td>
<td><input name="nom" type="text" id="nom" /></td>
<td>Descripcion:</td>
<td><input name="des" type="text" id="des" /></td>
</tr>
<tr>
<td>Tipo de Licencia:</td>
<td><select name="tli" id="tli" onChange="habilita()">
<option></option>
<option value="Freeware")>Freeware</option>
<option value="OEM")>OEM</option>
<option value="COA">COA</option>
<option value="Volumen">Volumen</option>
<option value="Copia">Copia</option>
</select></td>
<td>Clave de Licencia: </td>
<td><input name="cl" type="text" id="cl"/></td>
</tr>
<tr>
<td>Fecha de Inicio:</td>
<td><input name="fecha1" type="text" id="fecha1" size="11" maxlength="11" />
<input type="button" value="..." onClick="calen(1)">
</td>
<td>Fecha de Terminacion:</td>
<td><input name="fecha2" type="text" id="fecha2" size="11" maxlength="11" />
<input type="button" value="..." onClick="calen(2)">
</td>
</tr>
<tr>
<td>No. Equipos: </td>
<td>
<label>
<input name="ne" type="text" id="ne" onKeyPress='return esInteger(event)' size="2" maxlength="2"/></label>
</td>
<td>Status:</td>
<td>
<select name="status" id="status">
<option> </option>
<option>Activo </option>
<option>Baja </option>
</select>
</td>
</tr>
</table>
<br />Proveedor:
<select name="prov" size="1" id="prov">
<option> </option>
<?
mysql_select_db($database_invent_con, $invent_con);
$result = mysql_query ("SELECT * FROM proveedor");
while ($row = mysql_fetch_array($result)){
$nom = $row['nombre'];
echo "<option>$nom</option>";
}
?>
</select>
<br /> <input type="hidden" name="dateResult">
<br />
<label>
<input name="agregar" type="submit" value="Guardar"/></label>
</form> </font>
</center>
</font>
</body>
</html>
Cierto este manda a llamar a uno para el calendario que es este
Calendario.html
Código PHP:
<script language="JavaScript">
var dFec = new Date();
var aMonthNames = new Array(
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio",
"Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre");
function firstOfMonth(dFec){
var dRes = new Date();
dRes.setYear(dFec.getYear());
dRes.setMonth(dFec.getMonth());
dRes.setDate(1);
return dRes;
}
function lastDayOfMonth(dFec){
var dRes = new Date();
var nYear = dFec.getYear();
var nMonth = dFec.getMonth() + 1;
if (nMonth == 12){
nMonth = 0;
nYear++;
}
dRes.setYear(nYear);
dRes.setMonth(nMonth);
dRes.setDate(1);
return new Date(dRes.valueOf() - (24 * 60 * 60 * 1000));
}
function dayToWrite(nDay){
var dToday = new Date();
var bisThisMonth = ((dFec.getYear() == dToday.getYear()) && (dFec.getMonth() == dToday.getMonth()));
var sDay = String(nDay);
sDay = (nDay == dFec.getDate() && bisThisMonth? "<b><font color='red'>" + sDay + "</font></b>": sDay);
return sDay;
}
function selectDay(nDay){
var sRes, sDay, sMon, sYea;
sDay = "0" + String(nDay);
sDay = sDay.substr(sDay.length - 2, 2);
sMon = "0" + String(dFec.getMonth() + 1);
sMon = sMon.substr(sMon.length - 2, 2);
sYea = String(dFec.getFullYear());
sRes = sDay + "/" + sMon + "/" + sYea;
opener.document.forms[0].dateResult.value = sRes;
opener.fillDateField();
close();
}
function showCalenContents(){
var dFec0 = firstOfMonth(dFec);
var nDay = 1;
var nLastDay = lastDayOfMonth(dFec).getDate();
var sWeek = "";
var bEnd = false;
var bWri = false;
var nDOW0 = dFec0.getDay();
for (var j = 0; !bEnd; j++){
sWeek = "<tr>";
for (var i = 0; (i < 7) && !bEnd; i++){
bWri = bWri || (i == nDOW0);
if (bWri)
sWeek += "<td align='right' style='cursor: hand' onclick='parent.selectDay(" + String(nDay) + ")'>" + dayToWrite(nDay, bWri) + "</td>";
else
sWeek += "<td> </td>";
if (bWri) nDay++;
bEnd = (nDay > nLastDay);
}
if (bEnd)
for (var k = i; k < 7; k++)
sWeek = sWeek + "<td> </td>";
window.usefull.document.writeln(sWeek + "</tr>");
}
}
function backMonth(){
var nMonth = dFec.getMonth();
var nYear = dFec.getFullYear();
if (--nMonth == -1){
nMonth = 11;
nYear--;
}
dFec.setMonth(nMonth);
dFec.setYear(nYear);
calendary();
}
function forthMonth(){
var nMonth = dFec.getMonth();
var nYear = dFec.getFullYear();
if (++nMonth == 12){
nMonth = 0;
nYear++;
}
dFec.setMonth(nMonth);
dFec.setYear(nYear);
calendary();
}
function backYear(){
var nYear = dFec.getFullYear();
dFec.setYear(--nYear);
calendary();
}
function forthYear(){
var nYear = dFec.getFullYear();
dFec.setYear(++nYear);
calendary();
}
function showCalen(){
with (window.usefull.document){
write("<table border='0' width='100%' height='100%'><tr><td><table border='0' width='100%'><tr>");
write("<td width='10'><input type='button' name='bckYear' value='<<' onclick='parent.backYear()'></td>");
write("<td width='10'><input type='button' name='bckMonth' value='<' onclick='parent.backMonth()'></td>");
write("<td align='center'><b>" + aMonthNames[dFec.getMonth()].substr(0, 3) + ", " + String(dFec.getFullYear()) + "</b></td>");
write("<td width='10'><input type='button' name='ForMonth' value='>' onclick='parent.forthMonth()'></td>");
write("<td width='10'><input type='button' name='ForYear' value='>>' onclick='parent.forthYear()'></td>");
write("</tr></table></tr><tr><td>");
write("<center><table border='0'>");
write("<tr><td><b>D</b></td><td><b>L</b></td><td><b>M</b></td><td><b>M</b></td><td><b>J</b></td><td><b>V</b></td><td><b>S</b></td></tr>");
showCalenContents();
write("</table></center></td></tr></table>");
}
}
function calendary(){
with (window.usefull.document){
open();
writeln("<html><head></head><body>");
writeln("<form name='frm'>");
showCalen();
writeln("</form></body></html>");
close();
}
}
</script>
<html>
<head>
<frameset rows="100%,*" border="0" frameborder="no" framespacing="0" onLoad="calendary()">
<frame name="usefull" src="DummyPg.html" frameborder="no" marginheight="0" marginwidth="0" scrolling="no">
<frame name="useless" src="DummyPg.html" frameborder="no" marginheight="0" marginwidth="0" scrolling="no">
</frameset><noframes></noframes>
</head>
</html>