Category: Javascript

JavaScript Code

                var browser=navigator.appName;                 var b_version=navigator.appVersion; <a href=”http://www.justetc.net” target=”_blank”> <img border=”0″ alt=”hello” src=”b_pink.gif” id=”b1″ width=”26″ height=”26″ onmouseover=”mouseOver()” onmouseout=”mouseOut()” /> Place the following code under script tag/in a javascript file function mouseOver() {    document.getElementById(“b1″).src =”b_blue.gif”; } function mouseOut() {    document.getElementById(“b1″).src =”b_pink.gif”; } <map name=”planetmap”> <area shape =”rect” coords =”0,0,82,126″ onMouseOver=”writeText(‘You are over the target …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/javascript-code/

JavaScript Form Validation: Validate a Form Collecting Credit Card Information

    function validateCollectPaymentInformationForm()     {         var method, name, number, expiry, errMsg                  errMsg = “”;                  method = document.getElementById(‘paymentMethod’);         name =   document.getElementById(‘txtCCName’);         number = document.getElementById(‘txtCCNumber’);                  if (method.value == “” || method.value == “0” || method.value == null){ …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/javascript-form-validation-validate-a-form-collecting-credit-card-information/

Javascript : Miscellaneous Code

                var browser=navigator.appName;                 var b_version=navigator.appVersion; <a href=”http://www.justetc.net” target=”_blank”> <img border=”0″ alt=”hello” src=”b_pink.gif” id=”b1″ width=”26″ height=”26″ onmouseover=”mouseOver()” onmouseout=”mouseOut()” /> Place the following code under script tag/in a javascript file function mouseOver() {    document.getElementById(“b1″).src =”b_blue.gif”; } function mouseOut() {    document.getElementById(“b1″).src =”b_pink.gif”; } <map name=”planetmap”> <area shape =”rect” coords =”0,0,82,126″ onMouseOver=”writeText(‘You are over the target …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/javascript-miscellaneous-code/

GetElementsByName an example: Checkbox

<html>     <head>         <script type=”text/javascript”>             function getElements()               {               var x=document.getElementsByName(“myInput[]”);               alert(x.length);               alert(x[0].value);               alert(x[1].value);               alert(x[2].value);               }         </script> </head> <body>     <input …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/getelementsbyname-an-example-checkbox/

Driver template to create and start a Thread object.

** Taken from Core Web Programming from  *  Prentice Hall and Sun Microsystems Press,   *  © 2001 Marty Hall and Larry Brown;  *  may be freely used or adapted.  */ public class DriverClass extends SomeClass {   …   public void startAThread() {     // Create a Thread object.     ThreadClass thread = new …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/driver-template-to-create-and-start-a-thread-object/

Message.java Applet that reads customization parameters from an HTML file

******************* Message.java Applet that reads customization parameters from an HTML file ******************* import java.applet.Applet; import java.awt.*; ****************   public class Message extends Applet {   private int fontSize;   private String message;     public void init() {     setBackground(Color.black);     setForeground(Color.white);          // Base font size on window height.     fontSize = …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/message-java-applet-that-reads-customization-parameters-from-an-html-file/

DOM example that represents the basic structure of an XML document as a JTree

//XMLTree.java //Uses the following files Uses the following files:     * XMLFrame.java:Swing application to select an XML document and display in a JTree. ExtensionFileFilter.java Allows you to specify which file extensions will be displayed in a JFileChooser. test.xml Default file loaded if none selected by user. perennials.xml and perennials.dtd Data on daylilies and corresponding DTD. …

Continue reading

Permanent link to this article: http://bangla.sitestree.com/dom-example-that-represents-the-basic-structure-of-an-xml-document-as-a-jtree/