[thelist] safe js

Manuel González Noriega manuel at simplelogica.net
Tue Mar 16 08:30:34 CST 2004


Hi all,

Foreword: excuse my js newbieness :)


We've implemented [1] Adam Kalsey's CSS tabs [2]. Now, i'm trying to
give modern browsers the chance of doing the tab switch client-side. 
I'm targetting DOM Level 1 browsers, thus discriminating on
document.getElementById. 

With the help of quirksmode.org I've built this tiny funcion

function mytab(a) {
   if (!document.getElementById) return;
    var mydiv = document.getElementById('tabs');
    mydiv.setAttribute('class','new_'+a);
  }

which gets called from a tab link like this:
<a href="http://www.derallyes.com/portada/_noticias" id="noticias"
onclick="mytab(this.id);return false;" onkeypress="mytab(this.id);return
false;">noticias</a>


What i need is a solution to the scenario of browsers that are js
enabled but won't understand document.getElementById. These browsers
should just follow the href but my current code won't do that.

Any hint? Or is my approach plain wrong? TIA!

[1] http://derallyes.com (main page)
[2] http://kalsey.com/tools/csstabs/


  





-- 
Manuel González Noriega
Simplelógica, construcción web  
    URL: http://simplelogica.net
    EMAIL: simplelogica at simplelogica.net
    TELEFONO: (+34) 985 22 12 65
   
Logicola es el weblog de Simplelógica http://simplelogica.net/logicola/
</p>That's right. We said Frontpage.</p>



More information about the thelist mailing list