Saturday, December 17, 2005

Javascript is my new hero

Javascripts run on the client's machine and not on the server. It means that it runs very fast. Therefore, if possible, when there is a choice between coding php that will have to be executed on the server, or javascript, the answer is javascript.

An example. In my program sharealink the link may have a note describing the link and one or more comments from people who has visited the link. Sometimes it is nice to turn the notes and comments off.

I knew hov to turn one div block on and off, but not a whole bunch of them. Paulo Fierro, came to my rescue. By using
document.getElementsByTagName("div")
he created a loop that turn off or on all divs that started with 'note' and 'comment'. To see the code click the sharealink link above and view the page source. To see the code in action, just click the links Toggle notes and Toggle comments

My Internet bank uses a lot of javascript to make visits to my account a more pleasant one. The nice thing is that the code is right there under my nose. I choose view source and learn a lot. :)

1 comment:

Unknown said...

Whats up, https://www.maestrosharing.com is the best place for iptv server, cccam server and android.
Since i work with them i have no problem with any connection! Have a nice day !