Retroceder   Foros del Web > Programación para sitios web > Javascript

Respuesta
 
Herramientas Desplegado
Antiguo 28-abr-2008, 15:28   #1 (permalink)
AbdelioR sólo puede mejorar
 
Avatar de AbdelioR
 
Fecha de Ingreso: septiembre-2006
Ubicación: Tarragona
Mensajes: 817
error Object has no properties

Buenas, estoy usando el script starbox que es un sistema de votación de estrellas y funciona correctamente, lo único que una función muestra ese error cuando la llamo.

El firebug me muestra 1 error pero el script se ejecuta bien. En IE 6.0 este error peta y la web muestra un alert de error.


$("votar").down(".average") has no properties
[Break on this error] $('votar').down('.average').update(event.memo.aver age);



Como el código del script es muy largo no os lo pongo todo, a ver si alguien sabe decirme como se podria solucionar este error, o las causas mas generales que lo provocan para ver si puedo remediarlo.

Gracias.
__________________
::: www.hispanaworms.com ::: Comunidad de jugadores de W:A y WWP
AbdelioR está desconectado   Responder Citando
Antiguo 06-may-2008, 07:49   #2 (permalink)
AbdelioR sólo puede mejorar
 
Avatar de AbdelioR
 
Fecha de Ingreso: septiembre-2006
Ubicación: Tarragona
Mensajes: 817
Re: error Object has no properties

¿Nadie? .... :(
__________________
::: www.hispanaworms.com ::: Comunidad de jugadores de W:A y WWP
AbdelioR está desconectado   Responder Citando
Antiguo 06-may-2008, 07:53   #3 (permalink)
Moderador
caricatos es realmente agradablecaricatos es realmente agradablecaricatos es realmente agradablecaricatos es realmente agradablecaricatos es realmente agradablecaricatos es realmente agradable
 
Avatar de caricatos
 
Fecha de Ingreso: noviembre-2002
Ubicación: Torremolinos (Málaga)
Mensajes: 12.457
Re: error Object has no properties

Hola:

No tengo idea del problema porque no hay mucho código... pero un punto dentro de las comillas me parece sospechoso...

Pon más código si no te sirve la respuesta.

Saludos
__________________
Por favor:
No hagan preguntas de temas de foros en mensajes privados... no las respondo
caricatos esta en línea ahora   Responder Citando
Antiguo 06-may-2008, 12:58   #4 (permalink)
AbdelioR sólo puede mejorar
 
Avatar de AbdelioR
 
Fecha de Ingreso: septiembre-2006
Ubicación: Tarragona
Mensajes: 817
Re: error Object has no properties

Parte 1:

Bueno, es bastante código pero lo pongo a ver si alguien ve donde está el error.

Todo parte de esta clase, starbox.js:

Código HTML:
//  Starbox 1.1.0 - 01-04-2008
//  Copyright (c) 2008 Nick Stakenburg (http://www.nickstakenburg.com)
//
//  Licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.0 Unported License
//  http://creativecommons.org/licenses/by-nc-nd/3.0/

//  More information on this project:
//  http://www.nickstakenburg.com/projects/starbox/

var Starboxes = {
  options: {
    buttons: 5,                                  // amount of clickable areas
    className : 'default',                       // default class
    color: false,                                // would overwrite the css style to set color on the stars
    duration: 0.6,                               // the duration of the revert effect, when effects are used
    effect: {
      mouseover: false,                          // use effects on mouseover, default false
      mouseout: (window.Effect && Effect.Morph)  // use effects on mouseout, default when available
    },
    hoverColor: false,                           // overwrites the css hover color
    hoverClass: 'hover',                         // the css hover class color
    ghostColor: false,                           // the color of the ghost stars, if used
    ghosting: false,                             // ghosts the previous vote
    identity: false,                             // a unique value you can give each starbox
    indicator: false,                            // use an indicator, default false
    inverse: false,                              // inverse the stars, right to left
    locked: false,                               // lock the starbox to prevent voting
    max: 5,                                      // the maximum rating of the starbox
    onRate: Prototype.emptyFunction,             // default onRate, function(element, memo) {}
    rated: false,                                // or a rating to indicate a vote has been cast
    ratedClass: 'rated',                         // class when rated
    rerate: false,                               // allow rerating
    overlay: 'star.png',                      // default star overlay image
    overlayImages: '../media/images/',         // directory of images relative to this file
    stars: 5,                                    // the amount of stars
    total: 0                                     // amount of votes cast
  }
};

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('Y.1b(i,{3j:"1.6.0.2",3h:"1.8.1",1S:9(){3.1p("17");3.Z.2b=1;b A=/14(?:-[\\w\\d.]+)?\\.2Z(.*)/;3.1W=(($$("2Q 2J[v]").2k(9(B){h B.v.3I(A)})||{}).v||"").2j(A,"")+3.5.3A},1p:9(A){a((3l 1j[A]=="3k")||(3.1B(1j[A].3g)<3.1B(3["20"+A]))){3e("3c 3a "+A+" >= "+3["20"+A]);}},1B:9(A){b B=A.2j(/1v.*|\\./g,"");B=1t(B+"0".1r(4-B.2T));h A.2P("1v")>-1?B-1:B},2c:(9(B){b A=f 2G("2D ([\\\\d.]+)").2z(B);h A?(2w(A[1])<7):1M})(2p.2o),Z:9(B){B=$(B);b C=B.3H("2n"),A=1K.3D;a(C){h C}3C{C="3B"+A.2b++}3z($(C));B.3s("2n",C);h C},1G:[],3n:9(A){a(!3.1E(A.v)){3.1G.1a(A)}h A},1E:9(A){h 3.1G.2k(9(B){h B.v==A})},I:[],28:9(A){3.I.1a(A)},1i:9(){a(!3.I[0]){3.27=26;h}3.23(3.I[0])},23:9(C){b E=[],B=C.5.21,A=3.1E(B);3.I.G(9(F){a(F.5.21==B){E.1a(F);3.I=3.I.3d(F)}}.t(3));a(!A){b D=f 3b();D.39=9(){3.1w(E,{v:B,L:D.L,K:D.K,1V:D.v})}.t(3);D.v=i.1W+B}1T{3.1w(E,A)}},1w:9(B,A){B.G(9(C){C.1g=A;C.1R()});3.1i()},1s:(9(A){h{1e:"1e",R:"R",J:(A?"2S":"J")}})(17.1d.1m),2d:9(A){a(!17.1d.1m){A=A.2M(9(E,D){b C=Y.2K(3)?3:3.m,B=D.2H;a(B!=C&&!$A(C.2F("*")).2E(B)){E(D)}})}h A}});i.1S();2C.2e("2y:2x",i.1i.t(i));b 2v=2t.2s({2r:9(A,B){3.m=$(A);3.j=B;3.5=Y.1b(Y.2q(i.5),1K[2]||{});$w("M e u q").G(9(C){3[C]=3.5[C]}.t(3));3.X=3.5.X||(3.e&&!3.5.1n);a(!3.M){3.M=i.Z(3.m)}a(3.5.n&&(3.5.n.R||3.5.n.J)){i.1p("3G")}i.28(3);a(i.27){i.1i()}},2m:9(){$w("J R 1e").G(9(C){b B=C.2l(),A=3["1l"+B].3E(3);3["1l"+B+"1J"]=(C=="J"&&!17.1d.1m)?i.2d(A):A;3.16.2e(i.1s[C],3["1l"+B+"1J"])}.t(3));3.N.2i("c",{2h:"3y"})},2f:9(){$w("R J 1e").G(9(A){3.16.3r(i.1s[A],3["1l"+A.2l()+"1J"])}.t(3));3.N.2i("c",{2h:"3o"})},1R:9(){3.18=3.1g.K;3.15=3.1g.L;3.1F=3.1g.1V;3.O=3.18*3.5.1o;3.11=3.O/3.5.N;3.1c=3.5.u/3.5.N;a(3.5.n){3.2a=3.12(0);3.29=3.12(3.5.u)}b A={H:{U:"H",19:0,s:0,K:3.O+"k",L:3.15+"k"},1C:{U:"25",K:3.O+"k",L:3.15+"k"},24:{U:"H",19:0,s:0,K:3.18+"k",L:3.15+"k"}};3.m.Q("14");3.22=f l("o",{W:3.5.W||""}).c({U:"25"}).p(3.13=f l("o").p(3.1h=f l("o").p(3.1z=f l("o",{W:"1o"}).c(Y.1b({3f:"1Y"},A.1C)))));a(3.e){3.13.Q("e")}a(3.X){3.13.Q("X")}a(3.5.1O){3.1z.p(3.z=f l("o",{W:"z"}).c(A.H));a(3.5.1X){3.z.c({V:3.5.1X})}a(3.5.n){3.z.y=3.z.Z()}3.T(3.z,3.j,(1j.S&&S.1y))}3.1z.p(3.r=f l("o",{W:"r"}).c(A.H)).p(f l("o").c(A.H).p(3.16=f l("o").c(A.1C)));a(3.5.1x){3.r.c({V:3.5.1x})}a(3.5.n){3.r.y=3.r.Z()}3.5.1o.1r(9(B){b C;3.16.p(C=f l("o").c(Y.1b({V:"38("+3.1F+") 19 s 37-36",s:3.18*B+"k"},A.24)));C.c({s:3.18*B+"k"});a(i.2c){C.c({V:"35",34:"33:32.31.30(v=\'"+3.1F+"\'\', 2Y=\'2X\')"})}}.t(3));3.N=[];3.5.N.1r(9(D){b C,B=3.5.1U?3.O-3.11*(D+1):3.11*D;3.16.p(C=f l("o").c({U:"H",19:0,s:B+"k",K:3.11+(17.1d.1m?1:0)+"k",L:3.15+"k"}));C.x=3.1c*D+3.1c;3.N.1a(C)}.t(3));3.T(3.r,3.j);3.m.1Q(3.22);3.1u={};$w("j u e 1f q").G(9(B){3.m.p(3.1u[b]=f l("2W",{2V:"1Y",2U:3.M+"1v"+B,1P:""+(B=="1f"?!!3[b]:3[b])}))}.t(3));a(3.5.P){3.1h.p(3.P=f l("o",{W:"P"}));3.1A()}a(!3.X){3.2m()}},1Z:9(A){a(3.e&&3.5.1n){3.j=(3.q*3.j-3.e)/(3.q-1||1)}b B=3.e?3.q:3.q++;3.j=(3.j==0)?A:(3.j*(3.e?B-1:B)+A)/(3.e?B:B+1)},1A:9(){3.P.1Q(f 2R(3.5.P).3i({u:3.5.u,q:3.q,j:(3.j*10).2O()/10}))},12:9(B){b A=(3.O-(B/3.1c)*3.11);h 1t(3.5.1U?A.2N():-1*A.3m())},T:9(A,B){a(3.5.n&&3["1D"+A.y]){S.2L.3p(A.y).3q(3["1D"+A.y])}b D=3.12(B);a(1K[2]){b C=1t(A.2I("s")),F=3.12(B);a(C==F){h}b E=((3.29-(C-F).1q()).1q()/3.2a.1q()).3t(2);3["1D"+A.y]=f S.1y(A,{3u:{s:D+"k"},3v:{U:"3w",3x:1,y:A.y},2g:(3.5.2g*E)})}1T{A.c({s:D+"k"})}},2B:9(C){b B=C.m();a(!B.x){h}3.1Z(B.x);a(3.5.P){3.1A()}a(3.5.1O){3.T(3.z,3.j,(1j.S&&S.1y))}a(!3.e){3.13.Q("e")}3.1f=!!3.e;3.e=B.x;a(!3.5.1n){3.2f();3.13.Q("X");3.1N(C)}b A={};$w("j M u e 1f q").G(9(D){a(D!="M"){3.1u[D].1P=3[D]}A[D]=3[D]}.t(3));3.5.2A(3.m,A);3.m.1I("14:e",A)},1N:9(A){3.T(3.r,3.j,(3.5.n&&3.5.n.J));3.1H=1M;a(3.5.1k){3.1h.3F(3.5.1k)}a(3.5.1L){3.r.c({V:3.5.1x})}3.m.1I("14:s")},2u:9(B){b A=B.m();a(!A.x){h}3.T(3.r,A.x,(3.5.n&&3.5.n.R));a(!3.1H&&3.5.1k){3.1h.Q(3.5.1k)}3.1H=26;a(3.5.1L){3.r.c({V:3.5.1L})}3.m.1I("14:3J",{Z:3.5.M,u:3.5.u,x:A.x,q:3.q})}});',62,232,'|||this||options||||function|if|var|setStyle||rated|new||return|Starboxes|average|px|Element|element|effect|div|insert|total|colorbar|left|bind|max|src||rating|scope|ghost|||||||each|absolute|buildQueue|mouseout|width|height|identity|buttons|boxWidth|indicator|addClassName|mouseover|Effect|setBarPosition|position|background|className|locked|Object|identify||buttonWidth|getBarPosition|status|starbox|starHeight|starbar|Prototype|starWidth|top|push|extend|buttonRating|Browser|click|rerated|imageInfo|hover|processBuildQueue|window|hoverClass|on|IE|rerate|stars|require|abs|times|useEvent|parseInt|inputs|_|buildBatch|color|Morph|wrapper|updateIndicator|convertVersionString|base|activeEffect_|getCachedImage|starSrc|imagecache|hovered|fire|_cached|arguments|hoverColor|false|onMouseout|ghosting|value|update|build|load|else|inverse|fullsrc|imageSource|ghostColor|hidden|updateAverage|REQUIRED_|overlay|container|cacheBuildBatch|star|relative|true|batchLoading|queueBuild|maxPosition|zeroPosition|counter|fixIE|capture|observe|disable|duration|cursor|invoke|replace|find|capitalize|enable|id|userAgent|navigator|clone|initialize|create|Class|onMouseover|Starbox|parseFloat|loaded|dom|exec|onRate|onClick|document|MSIE|member|select|RegExp|relatedTarget|getStyle|script|isElement|Queues|wrap|ceil|round|indexOf|head|Template|mouseleave|length|name|type|input|scale|sizingMethod|js|AlphaImageLoader|Microsoft|DXImageTransform|progid|filter|none|repeat|no|url|onload|requires|Image|Lightview|without|throw|overflow|Version|REQUIRED_Scriptaculous|evaluate|REQUIRED_Prototype|undefined|typeof|floor|cacheImage|auto|get|remove|stopObserving|writeAttribute|toFixed|style|queue|end|limit|pointer|while|overlayImages|starbox_|do|callee|bindAsEventListener|removeClassName|Scriptaculous|readAttribute|match|changed'.split('|'),0,{}));

Ahora en un archivo.php, se crea el objeto de esta manera:

Código HTML:
<script language="javascript" type="text/javascript">


  new Starbox('votar', <?=$porcentaje;?>, { rated: false,<?=$bloqueado;?> rerate: false, max: 5, buttons: 5, stars: 5, identity:<?=$id?>, indicator: '<?=$indicator;?>',onRate:function(element, info) {
              var indicator = element.down('.indicator');
              indicator.update('Gracias por votar');
}, total: <?=$votos;?> });

</script>
__________________
::: www.hispanaworms.com ::: Comunidad de jugadores de W:A y WWP
AbdelioR está desconectado   Responder Citando
Antiguo 06-may-2008, 12:59   #5 (permalink)
AbdelioR sólo puede mejorar
 
Avatar de AbdelioR
 
Fecha de Ingreso: septiembre-2006
Ubicación: Tarragona
Mensajes: 817
Re: error Object has no properties

Parte 2:



Y las funciones que usa son estas:

Código HTML:
<script language="javascript" type="text/javascript">
// Here's how to overwrite default behaviour, using this for demos
Object.extend(Starboxes.options, { rerate: true });

// Create a Youtube style text indicator underneath the stars,
// using starbox custom events
function starboxChangedText(event) {
  var indicator = this.down('.indicator'),
  pick = (event.memo.rating || 0).round() - 1,
  indicator = this.down('.indicator');
  
  // for restoring, store the indicator text on the star if it was not set before.
  this.starboxResetText = this.starboxResetText || indicator.innerHTML;
  
  this.down('.indicator').update([
    'Malo',
	'Nada especial',
	'Vale la pena',
	'Bastante bueno',
	'¡Impresionante!'
  ][pick]);  
}

// here we restore the indicator on mouseout, if needed
function starboxLeftText(event) {
	this.down('.indicator').update(this.starboxResetText || '');
}

function saveStar(event) {
 
  new Ajax.Request('url/votar.php', {
                  parameters: event.memo,
                  method: 'post'
				  });
  $('votar').down('.average').update(event.memo.average);
				  
}

// attach the custom events on DOM loaded
document.observe('dom:loaded', function() {
     
$('votar').observe('starbox:changed', starboxChangedText) // observe the mouseover 
$('votar').observe('starbox:rated', saveStar);
$('votar').observe('starbox:left', starboxLeftText); // observe the mouseout

});

</script>
Lo único que da error es lo que comento arriba, que aunque en algunos navegadores funciona bien, el firebug hace saltar el error y en IE6 salta un alert también.

A ver si alguien con tiempo ve el error, :)
__________________
::: www.hispanaworms.com ::: Comunidad de jugadores de W:A y WWP
AbdelioR está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 15:33.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

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