JavaScript with Buttons, JavaScript Tutorial, Global Guide Line Technology.
Forum | Blog |


Basic JavaScript Guide.
 JScript Introduction.            
 JScript Why?                       
 JScript Recognitions.          
 JScript onMouseover.         
 JScript with Buttons.
 JScript Alerts.                     
 JScript Variables.               
 JScript Operators.               
 JScript Functions.               
 JScript Prompts.                 
 JScript Conditions.             
 JScript Validations.            
 JScript Confirmation Boxes.
 JScript Browser Detection.  
 JScript Redirection.            
 JScript on Links.                 
 JScript Switch.                    
 JScript Loops.                     
 JScript Events.                    
 JScript Exception Handling.
 JScript Reserve Characters. 
 JScript with Objects.            
 JScript Math Object.           
 JScript using Dates.             
 JScript using String.            
 JScript using Arrays.            
 JScript Operations.              
 JScript Handling Cookies.   
 JScript in Mapping.             
 JScript Time Out.                
 JScript Summary.                

JavaScript Tutorial >> JavaScript with Buttons.

     Back             Next     
JavaScript Tutorial will teach us about the JavaScript use with buttons. We can create effects using images as buttons. Here we need some images for use with JavaScript and three images for the different stages like normal, active and clicked. When the user moves his mouse over the first image, then the image will be switch to the active second image. When the user clicks the active image, the image will be switch to third clicked image, this process is just for showing the 3D effect.  Like as under

This is an effect that will create the feelings like a 3D button. JavaScript buttons are also known as mouse over buttons. JavaScript buttons can give nice effects to our web page. If its work is done properly, then JavaScript buttons give very impressive look and feel to the viewer. In this section of JavaScript Tutorial we will show you the creation of simple effects using JavaScript and how to attach JavaScript with the traditional HTML form buttons.  Like as under.

Example of JavaScript with HTML form button.

<TITLE>JavaScript Tutorial Example of JavaScript with HTML form button</TITLE>
<!-- Beginning of JavaScript below this HTML comment line

  function showOutput (message) {
     alert (message);

// - End of JavaScript Single Line Comment and HTML Comments - -->



  <FORM name="myForm">
    <INPUT NAME="textBox" TYPE="text">
    <INPUT NAME="showOut" TYPE="button" VALUE=" Show Me... "


Out put of JavaScript Example with Button


On the above JavaScript with button example as shown we write down our own JavaScript function with the name of showOutput(message) in HEAD section of an HTML file, it is better to use always follow the same convention mean write your all the JavaScript in HEAD instead of BODY.  And you will see that on almost all web site the JavaScript will be available in HEAD Tag.  The reason for this method is that the HEAD Tag always load or execute before BODY of an HTML document that's why if we use some JavaScript function and suppose we write if in BODY and use may or may not it will be execute.  Because suppose we use it before written in the document. It is better to always use JavaScript in HEAD Tag of HTML document.

     Back             Next     

Examples of JavaScript Frame, Frameset and iFrame Objects

Examples of JavaScript Select and Option Objects

Form Object and Form Elements Examples

[ About ] [ Contact ] [ Home ]
[ Links ] [ Site Map ] [ Services ] [ Privacy ]

Copyright 2005 -  2023 All rights reserved. (Best viewed in IE 6.0+ or Firefox 2.0+ at 1024 * 768 or higher) 376 visitors are online now