Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

thiagodede

Criar objeto em um local especifico.

Recommended Posts

Galera.. me ajudem.... conheco pouco de JAVASCRIPT e vi um codigo onde você facia uma escolha num LISTBOX, ai o Onchange mudava os dados de um segundo e apos escolher este segundo, ele criava um OBJETO, q era uma caixa de texto com um calendario.

O local onde ele criava era algo assim

 

<TD><DIV ID="#CRIA_AQUI"></DIV></TD>
so q ele passava como parametro para a funcao q criava o objeto essa ID. Vendo o JS, nao entendi como pq nao sei muito de JAVASCRIPT e era muito complicadoo COdigo.

 

o Objeto q tenho, onde eu coloco o NEW ele cria certim... Alguem sabe como posso fazer p mandar ele dar o Nem onde fica o DIV com ID xxx !?!!?

 

Vou anexar o arquivo JS q peguei p/ voces verem se conseguem achar . A funçao que cria o Objeto é a FUNCTION CALENDARIO, e o nome do ID é o o 2º parametro !!!

 

function esFecha(fechastr) {   var regexpfecha = /^([0-3][0-9])\/([0-1][0-9])\/([0-9][0-9][0-9][0-9])$/;   return regexpfecha.test(fechastr);}function fromFecha(fechastr) {   if ((fechastr != null) && (esFecha(fechastr))) {	  return (new Date(Math.floor(fechastr.substr(6, 4)),		 Math.floor(fechastr.substr(3, 2)) - 1,		 Math.floor(fechastr.substr(0, 2))));   } else {	  return new Date();   }}function toFecha(fechaobj) {   var diastr = fechaobj.getDate() + '';   diastr = (diastr.length == 1) ? '0' + diastr : diastr;   var messtr = (Math.floor(fechaobj.getMonth()) + 1) + '';   messtr = (messtr.length == 1) ? '0' + messtr : messtr;   yearstr = fechaobj.getYear();   // Hay navegadores que devuelven el nº de años desde 1900   if (Math.floor(yearstr) < 500) yearstr = Math.floor(yearstr) + 1900;   return diastr + '/' + messtr + '/' + yearstr;}function toFechaless(fechaobj) {   var diastr = fechaobj.getDate() + '';   diastr = (diastr.length == 1) ? '0' + diastr : diastr;   var messtr = (Math.floor(fechaobj.getMonth()) - 1) + '';   messtr = (messtr.length == 1) ? '0' + messtr : messtr;   yearstr = fechaobj.getYear();   // Hay navegadores que devuelven el nº de años desde 1900   if (Math.floor(yearstr) < 500) yearstr = Math.floor(yearstr) + 1900;   return diastr + '/' + messtr + '/' + yearstr;}function addDias(fecha, ndias) {   fecha.setDate(fecha.getDate() + ndias);   return fecha;}function getNumDias(fechaini, fechafin) {   return (Math.round((fromFecha(fechafin).getTime() - fromFecha(fechaini).getTime()) / (3600 * 24 * 1000)));}function getFechaHoy() {   return toFecha(new Date());}function esBisiesto(anyo) {   if ((anyo % 4) == 0 && ((anyo % 100) != 0 || (anyo % 400) == 0)) {	  return true;   }   return false;}function diaSemana(fecha) {   var inisem = 1; // 0-domingo, 1-lunes, 2-martes...   return ((fecha.getDay() + 6) % 7 + inisem);}function testDiaSemana(fecha, vdias) {   if ((vdias == null) || (!vdias.length) || (vdias.length == 0)) return true;   for (ndsm = 0; ndsm < vdias.length; ndsm++) {	  if (diaSemana(fecha) == vdias[ndsm]) {		 return true;	  }   }   return false;}function testFecha(fecha, fecinis, fecfins, diasems) {   if (fecfins == null) {	  if (fecinis == null) {		 return testDiaSemana(fecha, diasems);	  } else if (fecha >= fecinis[0]) {		 return testDiaSemana(fecha, diasems);	  } else {		 return false;	  }   }   for (nfec = 0; nfec < fecinis.length; nfec++) {	  if ((fecha >= fecinis[nfec]) && (fecha <= fecfins[nfec])) {		 if ((diasems != null) && (typeof(diasems) == 'object')) {			if (typeof(diasems[nfec]) == 'object') {			   if (testDiaSemana(fecha, diasems[nfec])) return true;			} else {			   if (testDiaSemana(fecha, diasems)) return true;			}		 } else {			return true;		 }	  }   }   return false;}function mesSiguiente(fecha, palante) {   var intervalo = new Array();   if (palante) {	  intervalo[0] = new Date(fecha.getTime());	  intervalo[0].setDate(1);	  intervalo[0].setMonth(intervalo[0].getMonth() + 1);	  intervalo[1] = new Date(fecha.getTime());	  intervalo[1].setDate(1);	  intervalo[1].setMonth(intervalo[1].getMonth() + 2);	  addDias(intervalo[1], -1);   } else {	  intervalo[0] = new Date(fecha.getTime());	  intervalo[0].setDate(1);	  intervalo[0].setMonth(intervalo[0].getMonth() - 1);	  intervalo[1] = new Date(fecha.getTime());	  intervalo[1].setDate(1);	  addDias(intervalo[1], -1);   }   return intervalo;}function primerMesOk(fecha, fecinis, fecfins, diasems, palante) {	  var intervalo = mesSiguiente(fecha, palante);   if (fecfins == null) {	  if (fecinis == null) {		 return intervalo[0];	  } else if (intervalo[1] >= fecinis[0]) {		 return intervalo[0];	  } else {		 return null;	  }   }   for (nfec = 0; nfec < fecinis.length; nfec++) {	  if (palante) {		 if (intervalo[0] <= fecfins[nfec]) break;	  } else {		 if (intervalo[1] >= fecinis[nfec]) break;	  }   }   if (nfec == fecinis.length) return null;   intervalo[0] = new Date(fecha.getTime());   var tope = new Date(fecha.getTime());   for (nfec = 0; nfec < fecinis.length; nfec++) {	  if (palante) {		 if (fecfins[nfec] > tope) tope = new Date(fecfins[nfec].getTime());	  } else {		 if (fecinis[nfec] < tope) tope = new Date(fecinis[nfec].getTime());	  }   }   while (intervalo[0] < tope) {	  intervalo = mesSiguiente(intervalo[0], palante);	  fechatmp = new Date(intervalo[0].getTime());	  while (fechatmp <= intervalo[1]) {		 if (testFecha(fechatmp, fecinis, fecfins, diasems)) return fechatmp;		 addDias(fechatmp, 1);	  }   }   return null;}function Calendario(nombreclase, donde, clase, clickdia, fechastr, fecinis, fecfins, diasems, colores, idioma) {   this.nombreclase = nombreclase;   if (typeof(donde) == 'object') {	  this.donde = donde;   } else {	  this.donde = document.getElementById(donde);   }   this.clickdia = clickdia;   this.clase = clase;   this.fechastr = fechastr;   this.fecinis = fecinis;   this.fecfins = fecfins;   this.diasems = diasems;   this.colores = colores;   this.fechaact = null;   this.fechastract = null;   this.fecinisact = null;   this.fecfinsact = null;   this.diasemsact = null;   this.dondefecha = null;   this.dondecalendario = null;   this.colorclaro = null;   this.coloroscuro = null;   this.diasel = null;   if ("ESP"==idioma) {	  this.nombremes = (typeof traducciones != "undefined" && typeof traducciones.nombremesabr != "undefined") ? traducciones.nombremesabr : new Array('Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic');	  this.abrevdia = (typeof traducciones != "undefined" && typeof traducciones.diasemsabr != "undefined") ? traducciones.diasemsabr : new Array('', 'L', 'M', 'X', 'J', 'V', 'S', 'D');   } else if ("ENG"==idioma) {	   this.nombremes = (typeof traducciones != "undefined" && typeof traducciones.nombremesabr != "undefined") ? traducciones.nombremesabr : new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');	   this.abrevdia = (typeof traducciones != "undefined" && typeof traducciones.diasemsabr != "undefined") ? traducciones.diasemsabr : new Array('', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa', 'Su');   }   // posicionamiento   	this.getRealLeft = function(objecte) {			xPos = objecte.offsetLeft;			auxObjecte = objecte.offsetParent;			while (auxObjecte != null) {				xPos += auxObjecte.offsetLeft;				auxObjecte = auxObjecte.offsetParent;			}			return xPos;		}		this.getRealTop = function(objecte) {			yPos = objecte.offsetTop;			auxObjecte = objecte.offsetParent;			while (auxObjecte != null) {				yPos += auxObjecte.offsetTop;				auxObjecte = auxObjecte.offsetParent;			}			return yPos;		}	this.posicionar = function (objeto, objetoref, offsetX, offsetY) {		offsetX = (offsetX != null) ? offsetX : 0;		offsetY = (offsetY != null) ? offsetY : 0;	  // capturamos la posición del elemento de referencia		var xPos = this.getRealLeft(objetoref) + offsetX;		var yPos = this.getRealTop(objetoref) + offsetY;	  // rectificaciones de la posición   	xPos -= 2;	   yPos += 1;	  // posicionamiento		objeto.style.position = 'absolute';		objeto.style.left = xPos;		objeto.style.top = yPos;	}	// iframe   this.IFrameObj = null;   this.IFrameDoc = null;   this.divContenedor = null;   this.posicionado = false;   this.dondePosicionar = null;   this.crearIframe = function() {	  if (!document.createElement) {return true};	  if (!this.IFrameObj && document.createElement) {		 var newdiv = document.createElement('DIV');		 newdiv.style.visibility='hidden';		 newdiv.style.position='absolute';		 newdiv.style.left='-10000px';		 newdiv.style.top='-10000px';		 newdiv.style.zIndex='10000';		 newdiv.style.backgroundColor='#ff0000';		 document.body.appendChild(newdiv);		   this.divContenedor = newdiv;		   var ancho = 102;  //this.ancho;		   var alto = 109;  //this.alto - 13;		 newdiv.innerHTML = '<iframe id="RSIFrame" name="rsframe" frameborder="0" scrolling="no" style="border:0px;width:'+ancho+'px;height:'+alto+'px"></iframe>';		 this.IFrameObj = document.getElementById('RSIFrame');		 if (document.frames) {			this.IFrameObj = document.frames['RSIFrame'];		 }	  }	  if (navigator.userAgent.indexOf('Gecko') !=-1		  && !this.IFrameObj.contentDocument) {		 eval("setTimeout('" + this.nombreclase + ".crearIframe()',10);");		 return false;	  }	  if (this.IFrameObj.contentDocument) {		 this.IFrameDoc = this.IFrameObj.contentDocument; // For NS6	  } else if (this.IFrameObj.contentWindow) {		 this.IFrameDoc = this.IFrameObj.contentWindow.document; // For IE5.5 and IE6	  } else if (this.IFrameObj.document) {		 this.IFrameDoc = this.IFrameObj.document; // For IE5	  } else {		 return true;	  }	  return false;   }   this.copiarEstilos = function(hojaorig, hojadest) {	  if (navigator.userAgent.toLowerCase().indexOf('msie') == -1)		 for (nest = 0; nest < hojaorig.cssRules.length; nest++)			eval("hojadest.insertRule('" + hojaorig.cssRules[nest].selectorText + " { "+ hojaorig.cssRules[nest].style.cssText +" }', hojadest.cssRules.length)");	  else		 for (nest = 0; nest < hojaorig.rules.length; nest++)			hojadest.addRule(hojaorig.rules[nest].selectorText, hojaorig.rules[nest].style.cssText);   }   this.inicializarIframe = function() {	  var strcss = '<style type="text/css" media="all"></style>';	  for (ncss = 1; ncss < document.styleSheets.length; ncss++) strcss = strcss + strcss;	  var html_base = '<html><head>' + strcss + '</head><body bgcolor="#ffffff" leftmargin="0" marginheight="0" marginwidth="0" topmargin="0"></body></html>';	  this.IFrameDoc.open();	  this.IFrameDoc.write(html_base);	  this.IFrameDoc.close();	  for (ncss = 0; ncss < document.styleSheets.length; ncss++) {		 this.copiarEstilos(document.styleSheets[ncss], this.IFrameDoc.styleSheets[ncss]);	  }   }	this.inicializarDondeCalendario = function() {		 var newdiv = this.IFrameDoc.createElement('DIV');		 newdiv.style.backgroundColor='#ffffff';		 this.IFrameDoc.body.appendChild(newdiv);		 this.dondecalendario = newdiv;	}	// fin iframe   this.getPropiedadEstilo = function(nomest, propiedad) {	  var nrules = (navigator.userAgent.toLowerCase().indexOf('msie') == -1) ? document.styleSheets[0].cssRules.length : document.styleSheets[0].rules.length;	  for (nest = 0; nest < nrules; nest++) {		 if (navigator.userAgent.toLowerCase().indexOf('msie') == -1) {			if (document.styleSheets[0].cssRules[nest].selectorText == ('.' + nomest))			   return eval("document.styleSheets[0].cssRules[nest].style." + propiedad + ";");		 } else {			if (document.styleSheets[0].rules[nest].selectorText == ('.' + nomest))			   return eval("document.styleSheets[0].rules[nest].style." + propiedad + ";");		 }	  }	  return '';   }   this.getFecha = function() {	  return this.diasel;   }   this.iconoCalendario = function() {	  return '<table valign="center" width="21" class="' + this.clase + '" style="border:0px" border="0" cellspacing="1" cellpadding="0">' +			 '<tr><td colspan="5" bgcolor="white" height="3"></td></tr>' +			 '<tr><td bgcolor="white" width="3" height="2"></td><td bgcolor="white" width="3" height="2"></td><td bgcolor="white" width="3" height="2"></td><td bgcolor="white" width="3" height="2"></td><td rowspan="3" width="3"></td></tr>' +			 '<tr><td bgcolor="white" width="3" height="2"></td><td bgcolor="white"></td><td bgcolor="white"></td><td bgcolor="white"></td></tr>' +			 '<tr><td bgcolor="white" width="3" height="2"></td><td bgcolor="white"></td><td bgcolor="white"></td><td bgcolor="white"></td></tr>' +			 '</table>';   }   this.ponerEstiloMano = function(obj) {	  if (navigator.userAgent.toLowerCase().indexOf('msie') == -1) {		 obj.style.cursor = 'pointer';	  } else {		 obj.style.cursor = 'hand';	  }   };   this.ponerEstiloCustom = function(elem, tamanyo, tipofuente, colortinta, colorfondo) {	  if (tamanyo) elem.style.fontSize = tamanyo + 'px';	  if (tipofuente) elem.style.fontFamily = tipofuente;	  if (colortinta) elem.style.color = colortinta;	  if (colorfondo) elem.style.backgroundColor = colorfondo;   }   this.getColorFecha = function(fecha) {	  if ((colores != null) && (colores.length)) {		 for (nfec = 0; nfec < this.fecinisact.length; nfec++) {			if ((fecha >= this.fecinisact[nfec]) && (fecha <= this.fecfinsact[nfec])) {			   return colores[nfec];			}		 }	  }	  return this.colorclaro;   }   this.poneClaseDiaCalendario = function(tdobj, fecha, ndia) {	  var fechatmp1 = new Date(fecha.getTime());	  fechatmp1.setDate(1);	  var nprimerdia = diaSemana(fechatmp1) - 1;	  var fechatmp2 = new Date(fechatmp1.getTime());	  fechatmp2.setMonth(fechatmp1.getMonth() + 1);	  var nultimodia = nprimerdia + Math.round((fechatmp2.getTime() - fechatmp1.getTime()) / (3600 * 24 * 1000)) - 1;	  if ((ndia < nprimerdia) || (ndia > nultimodia)) {		 this.ponerEstiloCustom(tdobj, 9, 'Arial', '#bbbbbb', '#ffffff');	  } else {		 addDias(fechatmp1, ndia - diaSemana(fechatmp1) + 1);		 if (testFecha(fechatmp1, this.fecinisact, this.fecfinsact, this.diasemsact)) {			this.ponerEstiloCustom(tdobj, 9, 'Arial', null, this.getColorFecha(fechatmp1));			eval("tdobj.onmouseover = function () {" + this.nombreclase + ".ponerEstiloCustom(this, 9, 'Arial', null, " + this.nombreclase + ".coloroscuro)}");			eval("tdobj.onmouseout = function () {" + this.nombreclase + ".ponerEstiloCustom(this, 9, 'Arial', null, '" + this.getColorFecha(fechatmp1) + "')}");			this.ponerEstiloMano(tdobj);			tdobj.setAttribute('id', 'diacal-' + toFecha(fechatmp1));			eval("tdobj.onclick = function () {" + this.nombreclase + ".clickDiaCalendario(this.getAttribute('id').substr(this.getAttribute('id').indexOf('-') + 1))};");		 } else {			this.ponerEstiloCustom(tdobj, 9, 'Arial', null, '#ffffff');		 }	  }   }   this.numDiaCalendario = function(fecha, ndia) {	  var fechatmp = new Date(fecha.getTime());	  fechatmp.setDate(1);	  addDias(fechatmp, ndia - diaSemana(fechatmp) + 1);	  return fechatmp.getDate();   }   this.fechasADate = function(fechas) {	  if (fechas != null) {		 for (nfec = 0; nfec < fechas.length; nfec++) {			if (typeof(fechas[nfec]) == "string") {			   fechas[nfec] = fromFecha(fechas[nfec]);			}		 }	  }   }   this.rellenarParametros = function() {	  this.fecinisact = (typeof(this.fecinis) == 'function') ? ((this.fecinis() == null) ? null : this.fecinis().slice(0)) : ((this.fecinis == null) ? null : this.fecinis.slice(0));	  this.fecfinsact = (typeof(this.fecfins) == 'function') ? ((this.fecfins() == null) ? null : this.fecfins().slice(0)) : ((this.fecfins == null) ? null : this.fecfins.slice(0));	  this.diasemsact = (typeof(this.diasems) == 'function') ? ((this.diasems() == null) ? null : this.diasems().slice(0)) : ((this.diasems == null) ? null : this.diasems.slice(0));	  this.fechasADate(this.fecinisact);	  this.fechasADate(this.fecfinsact);	  if (this.fecfinsact != null) {		 for (nfec = 0; nfec < this.fecfinsact.length; nfec++)			this.fecfinsact[nfec].setHours(23, 59, 59, 999);	  }	  if ((this.fechastr != null) && (typeof(this.fechastr) == 'object')) {		 this.fechastract = this.fechastr.value;	  } else {		 this.fechastract = this.fechastr;	  }	  if ((this.fechastract == null) || (this.fechastract == '')) {		 var intervalo = new Array();		 var fechatmp = new Date();		 intervalo[0] = new Date(fechatmp.getTime());		 intervalo[0].setDate(1);		 intervalo[1] = new Date(fechatmp.getTime());		 intervalo[1].setDate(1);		 intervalo[1].setMonth(intervalo[1].getMonth() + 1);		 addDias(intervalo[1], -1);		 fechatmp = new Date();		 while (fechatmp <= intervalo[1]) {			if (testFecha(fechatmp, this.fecinisact, this.fecfinsact, this.diasemsact)) break;			addDias(fechatmp, 1);		 }		 if (fechatmp <= intervalo[1])			this.fechaact = fechatmp;		 else			this.fechaact = primerMesOk(new Date(), this.fecinisact, this.fecfinsact, this.diasemsact, true);		 if (this.fechaact == null) this.fechaact = new Date();	  } else {		 this.fechaact = fromFecha(this.fechastract);	  }   }   this.getAnyoMenos = function(fecha) {	  var fechatmp = new Date(fecha.getTime());	  fechatmp.setFullYear(fechatmp.getFullYear() - 1);	  fechatmp.setMonth(fechatmp.getMonth() + 1);	  return primerMesOk(fechatmp, this.fecinisact, this.fecfinsact, this.diasemsact, true);   }   this.getMesMenos = function(fecha) {	  return primerMesOk(fecha, this.fecinisact, this.fecfinsact, this.diasemsact, true);   }   this.getMesMas = function(fecha) {	  return primerMesOk(fecha, this.fecinisact, this.fecfinsact, this.diasemsact, true);   }   this.getAnyoMas = function(fecha) {	  var fechatmp = new Date(fecha.getTime());	  fechatmp.setFullYear(fechatmp.getFullYear() + 1);	  fechatmp.setMonth(fechatmp.getMonth() - 1);	  return primerMesOk(fechatmp, this.fecinisact, this.fecfinsact, this.diasemsact, true);   }   this.generarCabeceraCalendario = function(donde) {	  if (!this.posicionado) {   		this.posicionar(this.divContenedor, this.dondePosicionar,3,17);		   this.posicionado = true;	  }	  var tblcab = this.IFrameDoc.createElement('TABLE');	  tblcab.setAttribute('width', '100%');	  tblcab.setAttribute('border', '0');	  tblcab.setAttribute('cellSpacing', '0');	  tblcab.setAttribute('cellPadding', '1');	  this.ponerEstiloCustom(tblcab, 9, 'Verdana', null, this.coloroscuro);	  tblcab.style.borderTop = 'solid 1px black';	  tblcab.style.borderLeft = 'solid 1px black';	  tblcab.style.borderRight = 'solid 1px black';	  var tbdcab = this.IFrameDoc.createElement('TBODY');	  tblcab.appendChild(tbdcab);	  var newtr = this.IFrameDoc.createElement('TR');	  var newtd = this.IFrameDoc.createElement('TD');	  newtd.setAttribute('align', 'center');	  newtd.innerHTML = '<b>«</b>';	  if (this.getAnyoMenos(this.fechaact) != null) {		 this.ponerEstiloMano(newtd);		 eval("newtd.onclick = function () {" + this.nombreclase + ".clickIconoCalendario('" + toFecha(this.getAnyoMenos(this.fechaact)) + "')};");	  } else {		 newtd.style.visibility = 'hidden';	  }	  newtr.appendChild(newtd);	  var newtd = this.IFrameDoc.createElement('TD');	  newtd.setAttribute('align', 'center');	  newtd.innerHTML = '«';	  if (this.getMesMenos(this.fechaact) != null) {		 this.ponerEstiloMano(newtd);		 eval("newtd.onclick = function () {" + this.nombreclase + ".clickIconoCalendario('" + toFechaless(this.getMesMenos(this.fechaact)) + "')};");	  } else {		 newtd.style.visibility = 'hidden';	  }	  newtr.appendChild(newtd);	  var newtd = this.IFrameDoc.createElement('TD');	  newtd.setAttribute('align', 'center');	  newtd.innerHTML = this.nombremes[this.fechaact.getMonth()] + ' ' + this.fechaact.getFullYear();	  newtr.appendChild(newtd);	  var newtd = this.IFrameDoc.createElement('TD');	  newtd.setAttribute('align', 'center');	  newtd.innerHTML = '»';	  if (this.getMesMas(this.fechaact) != null) {		 this.ponerEstiloMano(newtd);		 eval("newtd.onclick = function () {" + this.nombreclase + ".clickIconoCalendario('" + toFecha(this.getMesMas(this.fechaact)) + "')};");	  } else {		 newtd.style.visibility = 'hidden';	  }	  newtr.appendChild(newtd);	  var newtd = this.IFrameDoc.createElement('TD');	  newtd.setAttribute('align', 'center');	  newtd.innerHTML = '<b>»</b>';	  if (this.getAnyoMas(this.fechaact) != null) {		 this.ponerEstiloMano(newtd);		 eval("newtd.onclick = function () {" + this.nombreclase + ".clickIconoCalendario('" + toFecha(this.getAnyoMas(this.fechaact)) + "')};");	  } else {		 newtd.style.visibility = 'hidden';	  }	  newtr.appendChild(newtd);	  tbdcab.appendChild(newtr);	  tbdcab.appendChild(newtr);	  donde.appendChild(tblcab);   }   this.generarCuerpoCalendario = function(donde) {	  var fechatmp = new Date(this.fechaact.getTime());	  var tblcal = this.IFrameDoc.createElement('TABLE');	  tblcal.setAttribute('width', '100%');	  tblcal.setAttribute('border', '0');	  tblcal.setAttribute('cellSpacing', '1');	  tblcal.setAttribute('cellPadding', '0');	  tblcal.style.border = 'solid 1px #081c51';	  tblcal.style.backgroundColor = 'white';	  var tbdcal = this.IFrameDoc.createElement('TBODY');	  tblcal.appendChild(tbdcal);	  var newtr = this.IFrameDoc.createElement('TR');	  newtr.style.fontSize = '9px';	  newtr.style.fontFamily = 'Verdana';	  newtr.style.backgroundColor = this.coloroscuro;	  tbdcal.appendChild(newtr);	  var newtd;	  for (ndia = 1; ndia <= 7; ndia++) {		 newtd = this.IFrameDoc.createElement('TD');		 newtd.setAttribute('width', '13');		 newtd.setAttribute('align', 'center');		 newtd.innerHTML = this.abrevdia[ndia];		 newtr.appendChild(newtd);	  }	  for (ndia = 0; ndia < 42; ndia++) {		 if ((ndia % 7) == 0) {			newtr = this.IFrameDoc.createElement('TR');			tbdcal.appendChild(newtr);		 }		 newtd = this.IFrameDoc.createElement('TD');		 newtd.setAttribute('width', '13');		 newtd.setAttribute('align', 'center');		 newtd.innerHTML = this.numDiaCalendario(this.fechaact, ndia);		 this.poneClaseDiaCalendario(newtd, this.fechaact, ndia);		 newtr.appendChild(newtd);	  }	  donde.appendChild(tblcal);	  //tblcal.focus();   }   this.ponerFecha = function(fecha) {	  this.diasel = fecha;	  if (fecha)		 this.dondefecha.innerHTML = fecha;	  else		 this.dondefecha.innerHTML = ' ';   }   this.clickDiaCalendario = function(fecha) {	  this.diasel = fecha;	  this.dondefecha.innerHTML = fecha;	  while (this.dondecalendario.childNodes.length > 0)		   this.dondecalendario.removeChild(this.dondecalendario.lastChild);	  if (this.clickdia) this.clickdia(fecha);	  this.divContenedor.style.visibility = 'hidden';   }   this.clickIconoCalendario = function(nuevafecha, clickcal) {	  refrescar = ((clickcal != 1) || (this.dondecalendario.childNodes.length == 0))	  while (this.dondecalendario.childNodes.length > 0)		   this.dondecalendario.removeChild(this.dondecalendario.lastChild);		this.divContenedor.style.visibility = 'hidden';	  if (refrescar) {		 this.rellenarParametros();		 if ((nuevafecha != null) && (esFecha(nuevafecha))) {			this.fechaact = fromFecha(nuevafecha);		 }		 this.generarCabeceraCalendario(this.dondecalendario);		 this.generarCuerpoCalendario(this.dondecalendario);		  this.divContenedor.style.visibility = 'visible';	   }   }   this.colorclaro = this.getPropiedadEstilo('fondo_pastel', 'backgroundColor');   this.coloroscuro = this.getPropiedadEstilo('fondo_naranja', 'backgroundColor');   while (this.donde.childNodes.length > 0)	  this.donde.removeChild(this.donde.firstChild);   var tblcal = document.createElement('TABLE');   tblcal.setAttribute('width', '103');   tblcal.setAttribute('border', '0');   tblcal.setAttribute('cellSpacing', '1');   tblcal.setAttribute('cellPadding', '0');   tblcal.style.backgroundColor = 'white';   this.ponerEstiloCustom(tblcal, 9, 'Verdana', null, 'white');   var tbdcal = document.createElement('TBODY');   tblcal.appendChild(tbdcal);   var newtr = document.createElement('TR');   var newtd = document.createElement('TD');   newtd.setAttribute('width', '100%');   newtd.style.paddingLeft = '3px';   newtd.style.border = '1px solid black';   newtd.className = this.clase;   newtd.innerHTML = ' ';   if (fechastr) {1	  newtd.innerHTML = fechastr;	  this.diasel = fechastr;   }   this.dondefecha = newtd;   newtr.appendChild(newtd);   newtd = document.createElement('TD');   newtd.setAttribute('height', '16');   this.ponerEstiloMano(newtd);   eval("newtd.onclick = function() {" + this.nombreclase + ".clickIconoCalendario(" + this.nombreclase + ".dondefecha.innerHTML, 1)};");   newtd.innerHTML = this.iconoCalendario();   newtd.setAttribute('vAlign', 'bottom');   newtr.appendChild(newtd);   tbdcal.appendChild(newtr);   this.donde.appendChild(tblcal);   this.crearIframe();   this.inicializarIframe();   this.inicializarDondeCalendario();   this.dondePosicionar = tblcal;}

Compartilhar este post


Link para o post
Compartilhar em outros sites

muito grande esse codigo... credo hehehe

 

tente mudar isso:

newdiv.style.left='-10000px';		 newdiv.style.top='-10000px';

para isso:

newdiv.style.left=document.getElementById('#CRIA_AQUI').offsetLeft;		 newdiv.style.top=document.getElementById('#CRIA_AQUI').offsetTop;

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.