Skip to main content

Posts

Showing posts with the label JavaScript

JavaScript - Window Navigator

JavaScript Window Navigator The window.navigator object contains information about the visitor's browser. Window Navigator The  window.navigator  object can be written without the window prefix. Some examples: navigator.appName navigator.appCodeName navigator.platform Navigator Cookie Enabled The property cookieEnabled returns true if cookies are enabled, otherwise false: Example < p  id= "demo" > < /p > < script > document.getElementById("demo").innerHTML = "Cookies Enabled is " + navigator.cookieEnabled; < /script > The Browser Names The properties  appName  and  appCodeName  return the name of the browser: Example < p  id= "demo" > < /p > < script > document.getElementById("demo").innerHTML = "Name is " + navigator.appName + ". Code name is " + navigator.appCodeName; < /script > Did you know? IE11, Chrome,

JavaScript - Popup Boxes

JavaScript Popup Boxes JavaScript has three kind of popup boxes: Alert box, Confirm box, and Prompt box. Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click "OK" to proceed. Syntax window.alert(" sometext "); The  window.alert()  method can be written without the window prefix. Example alert("I am an alert box!"); Confirm Box A confirm box is often used if you want the user to verify or accept something. When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel", the box returns false. Syntax window.confirm(" sometext "); The  window.confirm()  method can be written without the window prefix. Example var r = confirm("Press a but

JavaScript - Testing Prototype

JavaScript - Testing Prototype Testing JavaScript Framework Libraries - Prototype Including Prototype To test a JavaScript library, you need to include it in your web page. To include a library, use the <script> tag with the src attribute set to the URL of the library: Including Prototype < !DOCTYPE  html > < html > < head > < script  src= "http://ajax.googleapis.com/ajax/libs/prototype/1.7.2.0/prototype.js" > < /script > < /head > < body > . . . Prototype Described Prototype provides functions to make HTML DOM programming easier. Like jQuery, Prototype has its $() function. The $() function accepts HTML DOM element id values (or DOM elements), and adds new functionality to DOM objects. Unlike jQuery, Prototype has no ready() method to take the place of window.onload(). Instead, Prototype adds extensions to the browser and the HTML DOM. In JavaScript, you can assign a function

JavaScript FAQs

Are the JavaScripts here free? What is the catch? Yes, we offer our site as a free "public service" resource. Simply stated, all the scripts on this site are free for personal or business use. The only requirement for use of archives is that you leave the credit information inside the script. We also don't think it's too much to ask if you would please link back to The JavaScript Source site to help spread the word about our site. The address for linking to The JavaScript Source is: http://www.JavaScriptSource.com Thanks! Do you write all the JavaScripts in this site? No, of course not. There are several thousand of them! What we do is collect many from across the Net and provide them in an organized and useful way. (We also write a portion of them.) If we have collected it from the Net, it will have the author credit info in the script. If there is not credit info, just the one for our site, then we wrote it or it is a 'public domain' script

JavaScript FAQ

Are the JavaScripts here free? What is the catch? Yes, we offer our site as a free "public service" resource. Simply stated, all the scripts on this site are free for personal or business use. The only requirement for use of archives is that you leave the credit information inside the script. We also don't think it's too much to ask if you would please link back to The JavaScript Source site to help spread the word about our site. The address for linking to The JavaScript Source is: http://www.JavaScriptSource.com Thanks! Do you write all the JavaScripts in this site? No, of course not. There are several thousand of them! What we do is collect many from across the Net and provide them in an organized and useful way. (We also write a portion of them.) If we have collected it from the Net, it will have the author credit info in the script. If there is not credit info, just the one for our site, then we wrote it or it is a 'public domain' script

Introduction of JavaScript

JavaScript is one of the 3 languages all web developers must learn: HTML to define the content of web pages CSS to specify the layout of web pages JavaScript to program the behavior of web pages Web pages are not the only place where JavaScript is used. Many desktop and server programs use JavaScript. Application of JavaScript JavaScript is used to create interactive websites. It is mainly used for: Client-side validation, Dynamic drop-down menus, Displaying date and time, Displaying pop-up windows and dialog boxes Displaying clocks etc. JavaScript Example Javascript example is easy to code. JavaScript provides 3 places to put the JavaScript code: within body tag, within head tag and external JavaScript file. Let’s create the first JavaScript example. < script type = "text/javascript" > document .write( "JavaScript is a simple language for javatpoint learners" ); < /script> Output: JavaScript is a simple