Hello, I am trying to load a script but i do not want to include a script just use the class. Example: Instead of doing - <div><script type="text/javascript">rain('Money');</script></div> Code (markup): I want to do this: <div class="rain">Money</div> Code (markup): And the effect will be the same.
Ok sorry for the late response, but i figure some stuff out. However, i am having a bug with the new updated code. $("document").ready(function(){ $(".rb").each(function(e){ var classes = "cyimking_rainbow" + parseInt(e+1); rainbownameload(classes); }); }); Code (markup): Specially, this is how i will load the code in html <span class="cyimking_rainbow1 rb">Cyimking</span> <br/> <span class="cyimking_rainbow2 rb">hello world!</span> <br/> Code (markup): Then it will do a rainbow effect. However, this is the error that i am having: - I simply want to use ONE class instead of mutliple classes. So instead of cyimking_rainbow1 , cyimking_rainbow2,; I would like cyimking_rainbow. - This is the error. <span class="cyimking_rainbow1 rb">Cyimking</span> <br/> <span class="cyimking_rainbow1 rb">hello world!</span> <br/> Code (markup): Instead of : Cyimking , hello world! Its doing this: Cyimkinghello world!, Cyimkinghello world! AGAIN, i am using this for my forum board and when i give the class to a group, it take ALL the objects that uses this class and replace each instance of that object per object... So instead of Cyimking, Cyimking, Cyimking, Admin.. Its doing this: CyimkingCyimkingCyimkingAdmin, CyimkingCyimkingCyimkingAdmin,CyimkingCyimkingCyimkingAdmin,CyimkingCyimkingCyimkingAdmin
e would always be '1' because it's an object for the element, NOT the number of elements counted! You'll need to maintain a separate counter, which is why I'd NOT be wasting time with jQuery's COMPLETELY POINTLESS 'each' function. (though I consider jquery on the whole to be pointless idiotic bloat) I'd also toss it in an anonymous function so it's not polluting the namespace. Just run this right before </body> (instead of wasting time waiting for onload) (function(){ var rbList = $('.rb'), count = 0; for (var rb in rbList) { rb.className.=' cyimking_rainbow' . ++count; } })(); Code (markup): Though I'd probably swing an axe at the fat bloated steaming pile of manure known as jQuery. For all the 'savings' it allegedly provides in writing code, it's horrifically offset by being fully half my ideal size limit for a page template (HTML+CSS+IMAGES+SCRIPTS!)
Gah, I'm switching languages too often... stupid typo. Should be: rb.className += ' cyimking_rainbow' + (++count);