JavaScript


      AboutMe      MyCurrentLocation     Blog      GuestBook     Story of a Techie cum fighter in the Real World     HOME 

<!-- =========How to Enable Javascript in Internet Explorer========= -->

To enable Java script in IE please follow the below procedure.

  1. Select Tools Choose Internet Options. Click Security  Click Custom Level
  2. Scroll down till you see section labeled Scripting. 
  3. Under Active Scripting, select Enable and click OK.


JAVASCRIPT CODING

Make exclusive use of alert and prompt in your javascript in order to pop up boxes but don't do it too much else your end user will run away. Also remember that when you use prompt for some data input uit returns a string by default.so you have to explicitly cast it into a number using the eval() function. Have a look at the sample code below where in i have added two numbers using a simbly kid types Javascript
 
<script>

    //Program will ask for two numbers add them up and return back the sum
    var firstNumber = 0;
    var secondNumber = 0;
    var sum = 0;
    firstNumber = prompt("Enter the First Number");
    secondNumber = prompt("Enter the Second Number");
    firstNumber = eval(firstNumber);
    secondNumber = eval(secondNumber);
    //The eval function will return us the number after seeing the data to be a number type
    sum = firstNumber + secondNumber;
    alert("The sum of numbers is "+sum);
</script>