Skip to main content

Posts

Showing posts with the label JavaScript

JavaScript Variables-Storage & Declaration

Now we have understood how simple scripting in JavaScript is written. Let us take in some input from the user using the prompt(); function. prompt(); function: The prompt function prompts the user to input data into it by providing a textbox.You also get two buttons to input your reaction.Hence the interactivity. Now the website has asked the input data, now let it process it and act upon it. You have entered the data asked by the webpage prompt, now let us store it in a variable. STORING OF VARIABLES USING prompt(); Storing the data directly upon entering is done using the variable declaration along with the prompt input function separated by a "=" sign. var num = prompt("Enter a number"); DECLARING OF VARIABLES In JavaScript variables are declared using the "var" keyword. Any variable can be created using this keyword, irrespective of the type of data it stores viz.textual,numerical,symbolical,patterns. Sample variable...

Simple Javascript

JavaScript Why is JavaScript special? JavaScript generates DYNAMIC content. JavaScript gives life to your content by animating certain parts and adds interactivity to it.Weren't the hyperlinks enough,why do I need more interactivity? Let us map this to the concept of writing in a book once again. It is pretty hard to imagine interactivity so let us take an example we are aware of i.e. cartoons we see animating in the television. Imagine one day you open your book and suddenly the objects start animating like the cartoons from your favorite bestselling television series. Similarly, JavaScript does the same thing to the content. This is just the beginning, it gets more deeper and denser by allowing you to have complete control of your page content with Server Side Scripting. In this post we have just begun with some simple functional interactivity. We have some simple functions in JavaScript like: 1.     alert(); 2.     document.write(); The alert(...