Computer Science

JavaScript

JavaScript is a high-level, interpreted programming language primarily used for creating interactive and dynamic content on websites. It is commonly used for client-side scripting to enhance user experience by enabling features like form validation, interactive maps, and dynamic content updates. JavaScript is supported by all major web browsers and is a fundamental technology for web development.

Written by Perlego with AI-assistance

7 Key excerpts on "JavaScript"

Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.
  • Teach Yourself VISUALLY Web Design
    • Rob Huddleston(Author)
    • 2010(Publication Date)
    • Visual
      (Publisher)

    ...In most cases, the application being used to run it will be a Web browser. However, many other applications support JavaScript in some form today, so you might also encounter it being used elsewhere. Browser Support Every major modern browser offers full support of JavaScript. Microsoft’s Internet Explorer officially supports ECMAScript, but this in effect means support of JavaScript. You can safely assume that, unless your user has specifically disabled it, all browsers will run your scripts. JavaScript Is Not Java Java is a very powerful object-oriented programming language from Sun Microsystems, whereas JavaScript is a scripting language. Except for the name, they in fact have absolutely nothing in common. Although beginning Web designers commonly confuse the two, care should be taken not to because no help is available for Java that would be useful for JavaScript programming, and vice versa. JavaScript and HTML JavaScript allows developers to achieve many effects not offered by HTML. For example, HTML form controls are extremely limited, and offer little in the way of validation mechanisms to ensure that the data being entered is what is expected. JavaScript allows developers to write as complicated a validation scheme as they need on top of the form. JavaScript can also work in conjunction with CSS to achieve advanced visual effects such as drop-down menus, accordion effects, and much more. Ajax Ajax was developed as a way to allow designers and developers to extend the capabilities offered by HTML and CSS. Most Ajax development is done through prebuilt JavaScript libraries, saving you time in having to rewrite code. The better, more widely adopted libraries focus on good usability and accessibility, and also provide many features such as the ability for JavaScript to refresh only a portion of a Web page...

  • Building Websites All-in-One For Dummies
    • David Karlins, Doug Sahlin(Authors)
    • 2012(Publication Date)
    • For Dummies
      (Publisher)

    ...One is that simple JavaScripts — such as creating alerts (popups), inserting the time, or providing a link that replicates the Back button on a browser — are useful tools and things you can do on your own. The other reason to learn basic JavaScript syntax is that it will help you look at, edit at times, and understand JavaScript that you get from other sources. But the meat of the minibook is showing you how to access, customize, and apply various available packages of JavaScript, including JavaScript libraries (customizable code) and generators (applications and resources that generate JavaScript code without coding). Seeing That JavaScript Is Client-Side Scripting Client-side scripting is basically a technical name for scripts that run in a browser — meaning, in this case, that JavaScripts run in a browser like Internet Explorer, Chrome, Firefox, or Safari. What are the real-world implications of this? It means that the things you do with JavaScript are constrained by its inability to send data to, or grab data from, a remote web server. For example, the scripts (programming) used to handle an order you place for a book at Amazon online or eBay have to run on a server — a massive computer that hosts websites and data. Those scripts combine user input (the order you place) with databases that store the price, shipping costs, inventory stock, and other data needed to fulfill your order. We examine server-side scripting in Book VI. Those are scripts that manage content on servers, like data submitted in a form. Where did that name come from? JavaScript has nothing to do with another programming language called Java. The origin of the name JavaScript is a weird story that can be boiled down to one word: marketing...

  • Confident Web Design
    eBook - ePub

    Confident Web Design

    Master the Fundamentals of Website Creation and Supercharge Your Career

    • Kenny Wood(Author)
    • 2018(Publication Date)
    • Kogan Page
      (Publisher)

    ...PART THREE JavaScript So far in this book we have covered how to define and structure the content of our webpages using HTML and then how to style that content using CSS. Now we turn our focus to how we define the webpage behaviour. This is where JavaScript comes into play. JavaScript is the language that will add interactivity to your webpages. It is a programming language, the first we have seen in this book and it is also the only programming language that can run in your browser. This is what makes it the de facto standard for adding interactivity to your webpage, as there simply is no alternative. Learning JavaScript is a must for all serious web designers and developers. So, what exactly can JavaScript do for your webpage? Well, JavaScript can do just about anything from creating alert prompts to appear on your webpage, to changing text dynamically at the click of a button, or even animating elements and a whole lot more. 07 JavaScript Part 1 What we will learn in this chapter In this chapter, we’re going to take a look at how JavaScript is used to dynamically modify our webpage. We’ll start with a basic example. Let’s analyse the following code snippet: HTML <div id=“hello-world”></div> <script> document.getElementById(“hello-world”).innerHTML = “Hello World!”; </script> You are now looking at your first snippet of JavaScript. We won’t break down the syntax just yet, but we will analyse what is going on here. You’ll notice we have added a set of <script> tags to wrap around our JavaScript. This is the most basic way of getting JavaScript to run on your page. The <script> tag tells the browser that we are trying to execute JavaScript code and to process it as JavaScript...

  • Web Design in easy steps, 6th edition

    ...8 JavaScript for interactive pages JavaScript enables you to make your web pages interactive. You can check that forms have been completed correctly, update the screen with text or photos; display randomly chosen special offers; and add sophisticated animation and formatting effects to your pages. In this chapter, you’ll learn the basics and discover some handy code you can adapt for your website. What is JavaScript? How to add JavaScript Creating functions Responding to user actions Showing and hiding content How it works Adding a toggle routine Simple form validation Checking text boxes More advanced form tests Customizing by date Opening new windows Adding random content Adding a photo slideshow Saving time with jQuery 2 quick jQuery examples What is JavaScript? While HTML is used to describe the structure of your content, and CSS lets you describe its appearance, JavaScript gives you the power to make the computer perform actions. It is a simple programming language that you can use to make your web page interactive. For security reasons, JavaScript is limited to working within the browser. That means that it can’t interfere with the website visitor’s computer, and access the hard disk, for example. You can, for example: • Update the screen contents after the page has downloaded. You might add new information that has become available since the web page first downloaded, or might show additional information that the user requests. Webmail service Gmail uses JavaScript to show you new messages that come in, without you having to refresh the web page, for example. • Make it easier for visitors to use forms by checking for any errors before the form information is sent to the server. You can provide immediate feedback so that users don’t waste time waiting for the server to respond. • Hide or reveal web page content...

  • Designing and Developing Robust Instructional Apps
    • Kenneth J. Luterbach(Author)
    • 2018(Publication Date)
    • Routledge
      (Publisher)

    ...Extending knowledge across multiple development environments increases your capabilities and favors efforts to make instructional apps ubiquitous across multiple digital devices. 3.1 Procedural Programming JavaScript is both a procedural programming language and object oriented. We begin with procedural programming features and then proceed to objective-oriented techniques, which arise in the section on Software Development Kits (Section 3.2.2). Using a procedural programming language, you can solve problems and express yourself creatively. 3.1.1 Input and Output To convey the effects of data processing to users, computer programs output results, which may be numeric or alphabetic. A series of alphabetic characters, such as “Hello, World,” is called a string. Our first JavaScript program will display “Hello, World!” and will run in either the Google Chrome or Firefox web browser. 1 To begin, open the JavaScript Console in Google Chrome by pressing Option-Command-J on a Mac or Control-Shift-I on a Windows PC (or you could drop down the View menu and select Developer; JavaScript Console). Alternatively, open the JavaScript Console in Firefox by pressing Option-Command-K on a Mac or Control-Shift-K on a Windows PC (or you could drop down the Tools menu and select Web Developer; Web Console). On a Windows PC, whether using Google Chrome or Firefox, make sure the Console tab is selected. Whether using a Mac or a Windows PC, in the JavaScript Console, type the following line of JavaScript code and press the Enter or Return key. console.log("Hello, World"); Do not be concerned that the word, undefined appears below “Hello, World.” Also in the JavaScript Console, enter a few arithmetic expressions, such as the following, and press the Enter or Return key after each expression. 3 + 8 28 * 2 + 1 (4 − 20) / 8 6 It is helpful to know that one can run JavaScript code within popular web browsers, but we will use SpiderMonkey JavaScript because it has several advantages...

  • HTML, CSS & JavaScript in easy steps

    ...15 Get Started in JavaScript This chapter is an introduction to the exciting world of JavaScript. It demonstrates how to add scripts to HTML documents that provide JavaScript variables and functions. Meet JS Include Scripts Console Output Make Statements Avoid Keywords Store Values Create Functions Assign Functions Recognize Scope Use Closures Summary Meet JS JavaScript (“JS”) is an object-based scripting language whose interpreter is embedded inside web browser software such as Google Chrome, Microsoft Edge, Firefox, Opera, and Safari. This allows scripts contained in a web page to be interpreted when the page is loaded in the browser to provide functionality. For security reasons, JavaScript cannot read or write files, with the exception of “cookie” files that store minimal data. Created by Brendan Eich at Netscape, JavaScript was first introduced in December 1995, and was initially named “LiveScript”. It was soon renamed, however, to perhaps capitalize on the popularity of Sun Microsystem’s Java programming language – although it bears little resemblance. Before the introduction of JavaScript, web page functionality required the browser to call upon “server-side” scripts, resident on the web server, where slow response could impede performance. Calling upon “client-side” scripts resident on the user’s system, overcame the latency problem and provided a superior experience. JavaScript quickly became very popular but a disagreement arose between Netscape and Microsoft over its licensing – so Microsoft introduced its own version named “JScript”. Although similar to JavaScript, the new JScript version had some extended features. Recognizing the danger of fragmentation, the JavaScript language was standardized by the Ecma International standards organization in June 1997 as “ECMAScript”...

  • Web Marketing for the Music Business
    • Tom Hutchison(Author)
    • 2013(Publication Date)
    • Routledge
      (Publisher)

    ...should be supplemented with human browser tests: ask friends with different hardware and software systems to test your site and report back to you before launching your site. CONCLUSION There is a variety of scripting codes that have been developed and evolved as web browsers and content have become more sophisticated. Now, efforts are underway for an inclusive scripting language (HTML5) that has the power and flexibility to be all things to all web users, whether on a Mac, a PC, or a mobile platform. Glossary Applet A small Java program that is cross-platform compatible and can be embedded in the HTML of a web page. Web browsers, which are usually equipped with Java virtual machines, can run the applets to perform interactive graphics, games, and so on. Browser A software application used to locate and display web pages. Contemporary browsers are graphical browsers, meaning they can display graphics as well as text and can present multimedia information, including sound and video, though they require plug-ins for some formats. CAPTCHA A program that can tell whether its user is a human or a computer. The process involves installing a program that can generate and grade tests—in this case an easy test of repeating the letters and numbers that appear in the distorted graphic that humans can read and software programs cannot. CGI scripts Common Gateway Interface (CGI) scripts are defined as script files executed on a web server in response to a user request. Used for user-generated forms. Client-side JavaScript (CSJS) JavaScript that enables web pages and client browsers to be enhanced and manipulated. Client-side programming Occurs on the end-user side of a client-server system—these programs are executed by your browser (the client). CSS Short for cascading style sheets, a feature being added to HTML that gives both web site developers and users more control over how pages are displayed...