Home » Archive by category "Online Computer Education" (Page 12)

How to Place JavaScript in an HTML Tag

  JavaScript can also be placed within HTML tags, as shown in the following example. <BODY onLoad=document.write(“Hello World!”)> </BODY> In this example, the JavaScript onLoad=document.write(“Hello World!”) statement has been added to the HTML <BODY> tag. This particular JavaScript statement tells the browser to write the enclosed text when the browser first loads the HTML page. Placing small JavaScript statements inside HTML tags provides an easy way to execute small pieces of...
Continue reading »

Learn how to Referencing JavaScript in an External .js File

    To store your JavaScripts in external files, you need to save them as plain text files with a .js file extension. You then need to add the SCR attribute to the opening <SCRIPT> tag in your HTML page as demonstrated here. <SCRIPT SRC=”Test.js” LANGUAGE=”JavaScript” TYPE=”Text/JavaScript”> </SCRIPT> In this example, an external JavaScript named Test.js has been specified. This external JavaScript can contain any number of JavaScript statements. However, it...
Continue reading »

Learn how to Placing JavaScripts in the Head Section of the HTML page.

JavaScripts also can be placed anywhere within the head section of your HTML pages. Unlike scripts embedded within the body section of HTML pages, scripts embedded in the head section are not necessarily automatically executed when the page loads. In some cases, they are executed only when called for execution by other statements within the HTML page. Most JavaScript programmers move all functions and most variables to the head section because...
Continue reading »

Learn Different Ways to Integrate JavaScript into Your HTML Pages.

  As you know, there are two places you can put your JavaScripts in an HTML page: in either the head or body section. In addition, I have told you that you can either embed JavaScript directly into the HTML page or reference it in as an external .js file. One more way you can integrate JavaScript into an HTML page is as a component in an HTML tag. Placing JavaScripts...
Continue reading »

Learn about JavaScript and Case Sensitivity.

You have to be extremely careful when keying in the text of your JavaScripts. JavaScript is a case sensitive programming language (unlike HTML, which enables you to use different capitalization when defining HTML tags). Case sensitivity means that you must type JavaScript elements exactly as they appear in this book in order for them to work. For example, as far as JavaScript is concerned, the words document and Document refer to...
Continue reading »

Create Your First JavaScript”Hello World” program.

  So far, we’ve introduced JavaScript and JScript, discussed their capabilities and differences, and gone over their history. We then discussed JavaScript browser compatibility issues and learned the syntax required to use the <SCRIPT> and </SCRIPT> tags to embed JavaScripts within HTML pages. Now it’s time to create your first JavaScript. It’s going to be a very basic example, so don’t get your hopes up too high. By tomorrow night, you’ll...
Continue reading »

How to Integrating JavaScript with HTML.

    JavaScripts are collections of programming statements that you embed in HTML documents by placing them within the <SCRIPT> and </SCRIPT> tags. These tags can be placed within either the head or body section of an HTML page. Figure 1.3 outlines the syntax that you must follow when using these tags in an HTML page. Syntax of the <SCRIPT> and </SCRIPT> tags when used with JavaScript. Several arguments can be...
Continue reading »

Many Kinds of Things you can do with JavaScript and JScript.

    The relatively simple and straightforward HTML that helped to make the Internet explode upon the scene in the mid-1990s enables you to create Web pages that display static information. Over the years, HTML has lost much of its luster. Markup languages are great for formatting the display of text, but they lack the capability to interact with visitors. People surfing the Internet have come to expect and demand more...
Continue reading »