Hi I'm learning jQuery by messing around with our schools new layout.

The live "official" template/site is at www.sfu.ca  I had already written my
own template by then www.sfu.ca/ehs .
One of the things I dislike about the official template is how they use JS
so I started to convert then to jQuery.

First up: A-Z script  the A-Z drop-down list is generated dynamically (I
know it is a waste to lead jQuery just for this but there more scripts
calling on jQ to follow).

Original (JS is called inline!)

document.write(' http://www.sfu.ca/dir/ A-Z Links <ul id="AtoZ">');

for( i=65;i<91;i++) {
        letter = String.fromCharCode(i+32);
        document.write( '<li> http://www.sfu.ca/dir/?'+letter+' '+letter+' 
</li>'
);
}

document.write('</ul>');

My simple hopefully unobstrusive jQuery attempt:

$(document).ready(function(){
                
        $("#insertAtoZ").after("<ul id='AtoZ'>"+AtoZ()+"<li> # &nbsp; 
</li></ul>");
                
                function AtoZ(){
                        html='';
                        for( i=0;i<26;i++) {
                                letter = String.fromCharCode(i+97);
                                html+= "<li> http://www.sfu.ca/dir/?"+letter+"; 
"+letter+" </li>";
                                }
                        return html;
                        }       
        });


Please comment on anything that could/should be improved upon.
Also:
 Is there a better way to generate letters A-Z?
 Is it wasteful to include the href on each letter? Would it be better to
attach a click function?
 Am I right 

Thanks, any comments appreciated.
-- 
View this message in context: 
http://www.nabble.com/Have-I-made-things-better-or-worse--tf3066338.html#a8528777
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to