webhosting Web Hosting Wit.Com
Webhosting, Server and Web Site Help & Information
Internet Services
  Domain Names
  Web Hosting
  Accept Credit Cards
  SSL Certificates
  T1 Connections
Coding Tutorials
  HTML Tags
  HTML Code
  Style Sheets
  PHP Tutorial
  ASP Tutorial
  SQL (Database)
  ASP Code
  HTML Templates
Tips & Tricks
  Design Dos & Don'ts
  HTML Tips
  Useful Applications
  Search Engines
  My IP Lookup
JavaScript Support
  JavaScript Language
  JavaScript Examples
  JavaScript Support
  Web Design Help
Contact Us
Home Page
html basic code
free html codes
Javascript Markup Language
Free Coding Tutorial

Javascript Markup Language

JavaScript can be combined with an HTML page to give it functionality and effects. JavaScript is interpreted by the web browser to perform various tasks and functions. JavaScript Markup Language is a different language than Java developed by Sun Microsystems.

Including JavaScript in HTML

You must alert the browser to your use of JavaScript in an HTML page for the browser to properly interpret the code.

Start JavaScript with this opening: <script language = “javascript”>

End your JavaScript closing with: </script>

Usually you would want to include the script between the <head> </head> tags, so that the code is parsed before the HTML on the page. However, some commands in JavaScript such as “onmouseover” and “onclick” do not require pre-notification to the browser, and are automatically parsed by the browser.

Case Sensitivity

Always be consistent when using JavaScript Markup Language commands, since they are case sensitive.

Comment Tags

Comments are programmers notes, so that you or another programmer can understand how your code was scripted. Always make good use of comment tags and programmers notes, because you may have to read this code again years from now when updating the site. There are two different kinds of comment tags you may use.

/* This set of tags with a forward slash and

asterisk may be used to comment out multiple lines. */

// The dual forward slashes are for single line comments.

Commonly Used Commands JavaScript Commands in HTML Documents

Mouse Over Status Bar

Here is a popular command using JavaScript within an HTML hyperlink. The onmouseover command adds a note to your window status bar in the lower right corner when you hover the mouse pointer over the link of most browsers. The onmouseout command then returns the window status bar to blank after removing your mouse pointer. Try the example below.

<a href="http://www.webhostingwit.com" onmouseover="window.status='Learn About Java'; return true;" onmouseout="window.status=' '; return true;">

Onclick Command

The onclick command sets your browser to submit a form when a button is clicked. The history.go( ) command sets your browser to go forward or back a predetermined number of pages in your browser history. Typically we use this to send a visitor back to the page they came from. A good application for this would be on a shopping cart if the visitor wanted to check the contents of the cart and then be returned back to the item they were looking at. Try the example below.

<form><input type="button" value="Go Back" onclick="history.go(-1);return true;"></form>

Pop Alert Box With Name Submit

For this Command you will have to utilize the script start and finish commands. This will pop up an alert box asking your visitor for their first name, and the it adds it to the web site when submitted.

<script language = "javascript">
var firstname = prompt("Please Enter Your First Name", "" );
document.write( "Hello " +firstname );

Pop Up Window Script using a Link

Pop Up Window Scripts are great for login boxes, banner ads, shipping information and more. For this pop up window script you will have to create a page to open in the window, example: banner1.html. We just used our web hosting page for our example.

<a href='#' onClick="window.open('index.html','','width=640,height=520,menubar=no,scrollbars=yes,resizeable=no');">Click Here For More Information</a>

Click below to try this example.
Click Here For More Information

Pop Up Window Script using a Form Button

This is the same pop up window script using a form button to open the window instead of a link.

<input type="button" value="Click Here Now" onClick="window.open('web_hosting.html','','width=640,height=520,menubar=no,scrollbars=yes,resizeable=no');">

Click below to try this example.

Pop Up Window Script using onLoad

The next example opens the popup window on load. Insert this javascript into the BODY tag at the top of your HTML code. This will utilize the onLoad javascript command to open the window everytime someone opens the page. This works great for popup banner ads.

<body onLoad="window.open('web_hosting.html','','width=640,height=520,menubar=no,scrollbars=yes,resizeable=no');">

If you have any programming tips, information, or scripts you would like to add to the site e-mail it to webmaster@webhostingwit.com

©2003 Web Hosting Wit.Com and its licensors. All Rights Reserved
Designed by Fencl Web Design