Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/06/2011, 12:14
Avatar de America|UNK
America|UNK
 
Fecha de Ingreso: noviembre-2006
Ubicación: Piura - Perú
Mensajes: 582
Antigüedad: 17 años, 5 meses
Puntos: 56
Respuesta: Cómo bloquear un link?

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>
__________________
/* El que atiende, entiende..., el que entiende, aprende!.
Desarrollo Web Freelance, Contactar */