Ver Mensaje Individual
  #5 (permalink)  
Antiguo 22/06/2011, 07:44
AitorCalo
 
Fecha de Ingreso: junio-2011
Ubicación: España
Mensajes: 3
Antigüedad: 12 años, 10 meses
Puntos: 0
De acuerdo Respuesta: Cómo bloquear un link?

Cita:
Iniciado por America|UNK Ver Mensaje
Tendrías que comprobar si los links han sido clickeados, por ejemplo agregarle un atributo a los que ya lo estén.
Un ejemplo. La función active(param1,param2) . El param1 contiene actGoogle (links con el atributo rel="actGoogle" que tienen que clickearse para activar el link Google), param 2 googleLink (Id del link Google)
Código HTML:
<style>
a.disabled {color:#999}
</style>
Links para activar Google.com
<a href="#" rel="actGoogle">Link 1</a>
<a href="#" rel="actGoogle">Link 2</a>
<a href="#" rel="actGoogle">Link 3</a>

<a href="http://www.google.com" id="googleLink" target="_blank">Google.com</a> 
Código Javascript:
Ver original
  1. <script>
  2. function active(quien,donde){
  3.     var d = document, a = d.getElementsByTagName("a"), Q = d.getElementById(donde), i,l;
  4.     var Links = function(fn){
  5.         for(i=0,l=a.length;i<l;i++){
  6.             if(a[i].tagName == 'A' && a[i].getAttribute("rel") == quien) fn(a[i])
  7.         }
  8.     }
  9.     Q.className = 'disabled'
  10.     Q.onclick = function(){return false}
  11.     Links(function(el){
  12.         el.onclick = function(){
  13.             this.act = 1; var all = 1
  14.             Links(function(el2){ if(!el2.act) all = 0})
  15.             if(all){
  16.                 Q.className = '';
  17.                 Q.onclick = function(){return true}
  18.             }
  19.         }
  20.     })
  21.  
  22. }
  23.  
  24. active("actGoogle","googleLink")
  25. </script>
Gracias, me funcionó. Lo llevaba buscando mucho tiempo, hasta que apareciste tú ;)

PD: Tienes Taringa? Te daría puntillos.