| You are here: | About>Computing & Technology>JavaScript |
![]() | JavaScript |
Alternatives to "eval"Some JavaScript commands are so inefficient and so rarely needed that you have to wonder why they are included in JavaScript in the first place. "eval" is one of the most misused JavaScript commands as well as being one of the least efficient to actually run. Almost every occasion where novice JavaScript programmers use eval it is actually unnecessary as JavaScript itself provides simple efficient ways of avoiding the need to use it in most instances. Alternatives to "eval" Friday May 9, 2008 | permalink | comments (0) What JavaScript Cannot DoUse the right tools for the job. While it is possible to put screws in with a spanner a screwdriver works far more effectively. Of course that screwdriver wont help much if all you have to use it with are nails. While there are a great many things that JavaScript can be used for to enhance your web pages and improve your visitors experience with your site, there are also a few things that JavaScript can't do. What JavaScript Cannot Do Thursday May 8, 2008 | permalink | comments (0) Aborting AjaxSometimes when waiting for an Ajax response the situation changes so that you no longer need it. Since Ajax is normally run asynchronously where we don't wait for the response to come back, circumstances may change so that the response is no longer required and we want to abort the request in order to make another more relevant one. In this twelfth Ajax tutorial we look at how to abort an outstanding Ajax request so that the browser can initiate a replacement request using the same code without getting confused between the original and replacement responses. Aborting Ajax Wednesday May 7, 2008 | permalink | comments (1) HTML Comments and JavaScriptWhat happens when you include HTML comments inside your JavaScript? When JavaScript was first introduced, only Netscape 2 supported it and so it was necessary to hide the JavaScript from browsers such as Netscape 1 and IE2 which didn't understand the script tag and would therefore display the script instead of running it. Many people still include the HTML comment code to hide the script from the huge number of visitors that they get who still use Netscape 1 and IE2. For those of us who don't have any visitors who still use such antiquated browsers we can remove those comments. Let's take a look at how we should be coding our embedded JavaScript now (as opposed to how it needed to be don way back in the 20th Century). HTML Comments and JavaScript Tuesday May 6, 2008 | permalink | comments (0) Extending ObjectsWhen JavaScript doesn't provide the method you need you can add it yourself. In the last few modern JavaScript tutorials we have looked at the many different objects that JavaScript defines for us to use with our JavaScript code. We are not just limited to those methods that JavaScript provides for those objects though because JavaScript allows us to extend the functionality of any object at any time simply by defining additional methods of our own. In the twentieth modern JavaScript tutorial we look at how you can extend the functioning of the built-in objects. This tutorial includes six examples of how to extend date objects and one of how to extend string objects. Extending Objects Monday May 5, 2008 | permalink | comments (0) Putting it all TogetherIf you have been following the original series of JavaScript tutorials over the last 30 or so weeks then you now have a basic knowledge of JavaScript. The final tutorial in the original "Learn JavaScript" series reviews why you have learned so far and what options you have to further develop your JavaScript skills. There is also a quiz that you can take to test how much you have learned so far about JavaScript programming. Putting it all Together Sunday May 4, 2008 | permalink | comments (0) Lotto PickerJavaScript has powerful array functionality. Sometimes just a few lines of JavaScript can do quite a lot. Many countries these days have some sort of lottery or lotto or pools (or whatever they call it) that requires you to select so many numbers out of a given total and if your numbers (or some of them) are drawn then you win a prize. To save you the trouble of picking your numbers you can get just as few lines of JavaScript to do it for you. Lotto Picker Saturday May 3, 2008 | permalink | comments (0) Body Mass Index CalculatorJavaScript can create all sorts of calculators, You just need to know how the calculation is done. When someone enters their height and weight into this JavaScript calculator then they will be told what their Body Mass Index is. If you don't know what BMI is then you probably don't need this calculator on your site but if you have a site that deals with health or diet then this is one of the first interactive options that you will want to add. Body Mass Index Calculator Friday May 2, 2008 | permalink | comments (0) Interest Rate ConverterJavaScript can handle both simple and complex calculations. The loan and repayment JavaScript calculators use the "nominal" interest rate which the lender divides by the number of times it is to be applied in the year to get the rate for each interest calculation. So a nominal rate of 12% calculated monthly means 1% per month. Calculating interest at 1% per month actually gives a higher "effective" interest rate for a year than the 12% we started with because the interest is compounded. This JavaScript Interest Rate Converter will allow you to find out the effective rate if you know the nominal rate and vice versa. Thursday May 1, 2008 | permalink | comments (0) Parsing XMLJavaScript contains code to make parsing XML returned from the server in order to make it easier to add it into your page. One common way to get the information passed back to your page after using Ajax to request it from the server is to receive it as XML. The request.responseXML property provided by Ajax provides a simple way of extracting the various pieces from what is returned as this twelfth Ajax tutorial demonstrates. Parsing XML Wednesday April 30, 2008 | permalink | comments (0) Display Latest Headlines | powered by WordPress |
|
All Topics | Email Article | Print this Page | | ![]() |
| Advertising Info | News & Events | Work at About | SiteMap | Reprints | Help | Our Story | Be a Guide |
| User Agreement | Ethics Policy | Patent Info. | Privacy Policy | ©2008 About, Inc., A part of The New York Times Company. All rights reserved. |


