Respuesta: agregar valor a caja de texto utilizando mootools este es la continuacion del codigo
Código:
show:function(caption,url,rel,force){
this.showLoading();
varbaseURL=url.match(/(.+)?/)[1]||url;
varimageURL=/\.(jpe?g|png|gif|bmp)/gi;
varqueryString=url.match(/\?(.+)/);
if(queryString)queryString=queryString[1];
varparams=this.parseQuery(queryString);
if(this.ResizeBox)this.ResizeBox.unbind('complete');//fixforjQuery
params=$.extend({},{
'width':0,
'height':0,
'modal':0,
'background':'',
'title':caption
},params||{});
params['width']=parseInt(params['width']);
params['height']=parseInt(params['height']);
params['modal']=parseInt(params['modal']);
this.overlay.options.hideOnClick=!params['modal'];
this.lightbox=$.extend({},params,{'width':params['width']+14});
this.navigator=this.lightbox.title?true:false;
if(force=='image'||baseURL.match(imageURL))
{
this.img=newImage();
this.img.onload=$.bind(this,function(){
this.img.onload=function(){};
if(!params['width'])
{
varobjsize=this.calculate(this.img.width,this.img.height);
params['width']=objsize.x;
params['height']=objsize.y;
this.lightbox.width=params['width']+14;
}
this.lightbox.height=params['height']-(this.navigator?21:35);
this.replaceBox({'resize':1});
this.ResizeBox.bind('complete',$.bind(this,function(){
this.showImage(this.img.src,params);
}));
});
this.img.onerror=$.bind(this,function(){
this.show('',this.options.imagesdir+'/'+this.options.color+'/404.png',this.options.find);
});
this.img.src=url;
}else
this.lightbox.height=params['height']+($.browser.opera?2:0);
this.replaceBox({'resize':1});
if(url.indexOf('TB_inline')!=-1)
{
this.ResizeBox.bind('complete',$.bind(this,function(){
this.showContent($('#'+params['inlineId']).html(),this.lightbox);
}));
}
elseif(url.indexOf('TB_iframe')!=-1)
{
varurlNoQuery=url.split('TB_');
this.ResizeBox.bind('complete',$.bind(this,function(){
this.showIframe(urlNoQuery[0],this.lightbox);
}));
}
else
{
this.ResizeBox.bind('complete',$.bind(this,function(){
$.ajax({
url:url,
type:"GET",
cache:false,
error:$.bind(this,function(){this.show('',this.options.imagesdir+'/'+this.options.color+'/404html.png',this.options.find)}),
success:$.bind(this,this.handlerFunc)
});
}));
}
}
this.next=false;
this.prev=false;
if(rel.length>this.options.find.length)
{
this.navigator=true;
varfoundSelf=false;
varexit=false;
varself=this;
$.each(this.anchors,function(index){
if($(this).attr('rel')==rel&&!exit){
if($(this).attr('href')==url){
foundSelf=true;
}else{
if(foundSelf){
self.next=self.getInfo(this,"Right");
exit=true;
}else{
self.prev=self.getInfo(this,"Left");
}
}
}
});
}
this.addButtons();
this.showNavBar(caption);
this.animate(1);
},
calculate:function(x,y){
varmaxx=$(window).width()-100;
varmaxy=$(window).height()-100;
if(x>maxx)
{
y=y*(maxx/x);
x=maxx;
if(y>maxy)
{
x=x*(maxy/y);
y=maxy;
}
}
elseif(y>maxy)
{
x=x*(maxy/y);
y=maxy;
if(x>maxx)
{
y=y*(maxx/x);
x=maxx;
}
}
return{x:parseInt(x),y:parseInt(y)};
},
handlerFunc:function(obj,html){
this.showContent(html,this.lightbox);
},
addButtons:function(){
if(this.prev)this.prev.bind('click',$.bind(this,function(obj,event){event.preventDefault();this.hook(this.prev);}));
if(this.next)this.next.bind('click',$.bind(this,function(obj,event){event.preventDefault();this.hook(this.next);}));
},
showNavBar:function(){
if(this.navigator)
{
this.bb.addClass("SLB-bbnav");
this.Nav.empty();
this.innerbb.empty();
this.innerbb.append(this.Nav);
this.Descripcion.html(this.lightbox.title);
this.Nav.append(this.prev);
this.Nav.append(this.next);
this.Nav.append(this.Descripcion);
}
else
{
this.bb.removeClass("SLB-bbnav");
this.innerbb.empty();
}
},
showImage:function(image,size){
this.Background.empty().removeAttr('style').css({'width':'auto','height':'auto'}).append('<imgid="'+this.options.name+'-Image"/>');
this.Image=$('#'+this.options.name+'-Image');
this.Image.attr('src',image).css({
'width':size['width'],
'height':size['height']
});
this.Contenedor.css({
'background':'none'
});
this.Contenido.empty().css({
'background-color':'transparent',
'padding':'0px',
'width':'auto'
});
},
showContent:function(html,size){
this.Background.empty().css({
'width':size['width']-14,
'height':size['height']+35,
'background-color':size['background']||'#ffffff'
});
this.Contenido.empty().css({
'width':size['width']-14,
'background-color':size['background']||'#ffffff'
}).append('<divid="'+this.options.name+'-Image"/>');
this.Image=$('#'+this.options.name+'-Image');
this.Image.css({
'width':size['width']-14,
'height':size['height'],
'overflow':'auto',
'background':size['height']||'#ffffff'
}).append(html);
this.Contenedor.css({
'background':'none'
});
},
showIframe:function(src,size,bg){
this.Background.empty().css({
'width':size['width']-14,
'height':size['height']+35,
'background-color':size['background']||'#ffffff'
});
varid="if_"+newDate().getTime()+"-Image";
this.Contenido.empty().css({
'width':size['width']-14,
'background-color':size['background']||'#ffffff',
'padding':'0px'
}).append('<iframeid="'+id+'"frameborder="0"></iframe>');
this.Image=$('#'+id);
this.Image.css({
'width':size['width']-14,
'height':size['height'],
'background':size['background']||'#ffffff'
}).attr('src',src);
this.Contenedor.css({
'background':'none'
});
},
showLoading:function(){
this.Background.empty().removeAttr('style').css({'width':'auto','height':'auto'});
this.Contenido.empty().css({
'background-color':'transparent',
'padding':'0px',
'width':'auto'
});
this.Contenedor.css({
'background':'url('+this.options.imagesdir+'/'+this.options.color+'/loading.gif)no-repeat50%50%'
});
this.Contenido.empty().css({
'background-color':'transparent',
'padding':'0px',
'width':'auto'
});
this.replaceBox($.extend(this.options.BoxStyles,{'resize':1}));
},
parseQuery:function(query){
if(!query)
return{};
varparams={};
varpairs=query.split(/[;&]/);
for(vari=0;i<pairs.length;i++){
varpair=pairs[i].split('=');
if(!pair||pair.length!=2)
continue;
params[unescape(pair[0])]=unescape(pair[1]).replace(/\+/g,'');
}
returnparams;
},
shake:function(){
vard=this.options.shake.distance;
varl=this.Wrapper.position();
l=l.left;
for(x=0;x<this.options.shake.loops;x++){
this.Wrapper.animate({left:l+d},this.options.shake.duration,this.options.shake.transition)
.animate({left:l-d},this.options.shake.duration,this.options.shake.transition);
}
this.Wrapper.animate({"left":l+d},this.options.shake.duration,this.options.shake.transition)
.animate({"left":l},this.options.shake.duration,this.options.shake.transition);
}
}
})(jQuery);
y los mando llamar en medio del head asi
Código:
<link rel="stylesheet" href="global.css" type="text/css" media="all" />
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="jquery.easing.1.3.js"></script>
<script type="text/javascript" src="sexylightbox.v2.3.jquery.min.js"></script>
<link rel="stylesheet" href="sexylightbox.css" type="text/css" media="all" />
<script type="text/javascript">
$(document).ready(function(){
SexyLightbox.initialize({color:'black', dir: 'sexyimages'});
});
</script>
como ven necesito mas paginas js y css para que funcione, pero como ya mensione el mas importante es sexylightbox.v2.3.jquery.js
y cuando lo ocupo en la caja de texto hago que la ventana aparesca con un href de esta forma
Código:
<div id="login-form">
<a class="pureCssMenui" href="ingresar_datos.jsp?height=350&width=360&" title="Escoger Dato" target="_blank" rel="sexylightbox">Escoger Datos: <input name="cajadestino" type="text" id="cajadestino" ></a>
</div>
<script type="text/javascript">
document.write(unescape("%3Cscript src='ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-2851998-1");
pageTracker._trackPageview();
</script>
</div>
y en caja destino necesito que me ponga lo que seleccione en mi ventana motools
por cierto los js no son propios, y se pueden modificar para hacerlos mas funcionales
espero y me puedan ayudar caricatos y masterpupet
Última edición por valdo_kof; 14/12/2010 a las 08:29 |