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 …
Category: Javascript
Aug 29
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){ …
Aug 29
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 …
Aug 29
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 …
Aug 29
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 …
Aug 26
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 = …
Aug 25
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. …