Skip navigation

Category Archives: javascript

Might sound funny.. but ya.. i liked what i did today, so thought of sharing it..

So there was this combo box which needed to be pre-filled with currencies. This list of currencies was also loaded in a javascript array for other reasons.

The immediate refactoring was to use array to create options for the combo box. So i created a function which was called on body OnLoad event which would fill the select html element.

Was this required? This function will be called only once that too only onload of the page. Hmmm.. So my next refactoring was to remove the function and make javascript inline with my html body content.. Solved!

The advantages:

  • The function would make no sense, as in imagine a developer checking this code, he would be confused as to where all this function is used.
  • Debugging is easier. You don’t have to go to head to check your function, rather can just ¬†write the js code where ur html element is.

The disadvantages(as mentioned by Kirit Pamar):

  • The javascript code is sent to the client each time a request is made to that page. This would be the case even if we called a method on body load. You could shove this script in a .js file and call the method on body load. This would improve the page load for each subsequent page request.

Ya, there definately must be a smile on people who have gone through the torture of testing web apps on different browsers. Well here it is.. Adobe is come up with this excellent thingy of testing web apps online on different browsers through only one interface. :) CONFUSED?? try it out yourself here

P.S. You need to register for the same. Good news.. Its free.. :)

Well, am a frequent user of Orkut! Orkut has evolved immensely and i guess everyone will agree with me..

It had frequent updates adding new features for better browsing experience.
I remember when orkut was first released, to reply to a scrap, we had to visit the senders profile, then open his scrapbook and then scrap him/her. Now its a lot faster with reply option in the scrapbook itself!!

One more thing of orkut that i have noticed, is how its fetches images while viewing the gallery section. Orkut first displays a low resolution images, rather a thumb of the actual image, and in mean time fetches the high resolution image.! Once the image has completely loaded, it just replaces the lower version(resolution) of the image!!

I have a simple html page to share! Click here to view

Orkut also prefetches other images in the gallery which could be simply done by having an array of images to be prefetched at page load.