for sexy code, you are right... binding the click is way cooler than
all those identical-ish hrefs!
but it works... spend some time with ajax and just get the letters
that actually used, and perhaps a in page pull down menu for ALL the
items under that letter!
After all this is a new millenium, and you can save your users a whole
extra page and a whole extra click on that page!
and for loops don't have to be simple numbers!
for (L = 'A';L <= 'Z'; L= String.charCodeAt(String.fromCharCode(L)+1))
On 1/23/07, Angelo Sozzi <[EMAIL PROTECTED]> wrote:
>
> 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> #
> </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/
>
--
Ⓙⓐⓚⓔ - יעקב ʝǡǩȩ ᎫᎪᏦᎬ
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/