Search
Relevant Links
Top 10 Articles
Jetty - Java Developers's Guide To Latest Web Server Technology
Jetty, an Open source application server from Java has been the talk of the Developers community these days
Jetty - Java Developers's Guide To Latest Web Server Technology
Advantage And Disadvantages Of String Implementation In JAVA
Advantages of the String implementation in JAVA
Advantage And Disadvantages Of String Implementation In JAVA
Hibernate Vs JDBC Performance
The Hibernate advantage over JDBC
Hibernate Vs JDBC Performance
Choosing Java Vs .Net For Web Development
Choosing Java Vs .Net For Web Development
Choosing Java Vs .Net For Web Development
How To Call Java Applet Functions From Javascript
How to Call Java Applet Functions From Javascript
How To Call Java Applet Functions From Javascript
Java 2 Platform Enterprise Edition (J2EE) Three-Tier Model
Enterprise edition of J2EE is used for developing modular enterprise request.
Java 2 Platform Enterprise Edition (J2EE) Three-Tier Model
What Is Java Virtual Machine
What is java virtual machine?
What Is Java Virtual Machine
How Does Java Handle Overriding
Overriding tactics in Java is very different from C++ as methods by default in Java can be overridden unlike C++
How Does Java Handle Overriding
Java Interface Overview
Interface: Interfaces can be used to implement the Inheritance relationship between the non-related classes that do not belongs to the same hierarchy, i.e. any Class and any where in hierarchy
Java Interface Overview
Enterprise Java Bean Application Development With A Three-Tier Architecture
Enterprise java beans is basically a server side component architecture for developing modular enterprise applications based on the java platform
Enterprise Java Bean Application Development With A Three-Tier Architecture
Use Of Hibernate With Java Persistence API
Hibernate has become immensely popular amongst the developer community as it is a free, powerful, high performance open source object
Use Of Hibernate With Java Persistence API
Java Embedded Applications
Java, or J2ME is a format for applications for mobile and PDAs. It provides software that can been added to mobile phones
Java Embedded Applications
How Does Java Handle Overriding?
Overriding tactics in Java is very different from C++ as methods by default in Java can be overridden unlike C++. In C++, the concept of overriding functions are handled by Virtual Table, VTable
How Does Java Handle Overriding?
Work With Teradata Using Java
Teradata is one of the leading vendor in data analytics and data warehousing applications and softwares.
Work With Teradata Using Java
Point To Point Video Conferencing Using Java's JMF API
When a face-to-face meeting with someone far away becomes a necessity or a compelling presentation must be given to a remote person,
Point To Point Video Conferencing Using Java's JMF API
Learning Java Programming Coding Language
There are many programming languages available and each of them is suitable for another program or application.
Learning Java Programming Coding Language
Java Hashtable
A collection allows a group of objects to be treated as a single unit.
Java Hashtable
Working With JNDI In A J2SE Application
Java Naming and Directory Interface (JNDI) allows Java objects to be published to a directory service which can be accessed by other Java applications later.
Working With JNDI In A J2SE Application
Java Games - The World Of Excitement Is Readying With Options!
Mobile phones have grown from the pedestal of a mere communication tool and with the aid of some innovative steps plus the technological up-gradation
Java Games - The World Of Excitement Is Readying With Options!
Everything You Need To Know And How To Use Java
Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s
Everything You Need To Know And How To Use Java
Of CGI And Java Scripts
CGI and Java Scripts are both functional with both Netscape and Internet Explorer browsers.
Of CGI And Java Scripts
Free Java Games - Entertain Yourself In Your Leisure Time
Today, you can find cell phones having multifunctional organisational tools
Free Java Games - Entertain Yourself In Your Leisure Time
Ajax Applications Development
AJAX has not only sprouted but has got root hold in developing dynamic web applications,
Ajax Applications Development
Benefits And Pitfalls Of A Java-Based Forex Trading Platform
Many forex brokers today offer a Java-based platform to traders as opposed to the traditional software that needs to be installed on your computer.
Benefits And Pitfalls Of A Java-Based Forex Trading Platform
Point To Point Video Conferencing Using Java's JMF API
When a face-to-face meeting with someone far away becomes a necessity or a compelling presentation must be given to a remote person, video conferencing is always your best choice
Point To Point Video Conferencing Using Java's JMF API
What Is CLASSPATH
A path specifies the name and location of a file on the file system.
What Is CLASSPATH
Javascript Is Not Java
Repeat after me: JavaScript is not Java, JavaScript is not Java. . .
Javascript Is Not Java
Eclipse IDE
Eclipse is an open-source, platform-independent software framework for delivering what the project calls "rich-client applications".
Eclipse IDE
Tomcat Jsp Run Error:Unable To Find A Javac Compiler
I always get this error when I run simple jsp files in my Tomcat 5.0.19/win2000. These jsp files run on other versions of Tomcat on the same PC. Any ideas?
Tomcat Jsp Run Error:Unable To Find A Javac Compiler
Deploying Web Applications To Tomcat
In this article we are going to cover the deployment of web applications using Tomcat.
Deploying Web Applications To Tomcat
Running The Tomcat 4.0 Servlet/JSP Container
Tomcat 4.0, a server that implements the Servlet 2.3 and JSP 1.2 Specifications from Java Software. In order to install and run this container, you must do the following
Running The Tomcat 4.0 Servlet/JSP Container
SOAP Example
In the example below, a GetStockPrice request is sent to a server. The request has a StockName parameter, and a Price parameter will be returned in the response.
SOAP Example
SOAP HTTP Binding
HTTP communicates over TCP/IP. An HTTP client connects to an HTTP server using TCP. After establishing a connection, the client can send an HTTP request message to the server:
SOAP HTTP Binding
SOAP Fault Element
The optional SOAP Fault element is used to hold error and status information for a SOAP message.
SOAP Fault Element
SOAP Body Element
The mandatory SOAP Body element contains the actual SOAP message.
SOAP Body Element
Introduction To SOAP
SOAP is a simple XML based protocol to let applications exchange information over HTTP.
Introduction To SOAP
Where Did Java Come From?
In the late 1970's Bill Joy thought about doing a language that would merge the best features of MESA and C
Where Did Java Come From?
What Is Java?
Java, formerly known as oak, is an object-oriented programming language developed by Sun
What Is Java?
How Do I Format Numbers Like C's Printf()?
Java does not have any built in equivalent to C's printf/sprintf/fprintf family of functions that specify the width and precision of numbers converted into strings.
How Do I Format Numbers Like C's Printf()?
How Do I Play A Sound In An Application?
Java's audio support comes from the AppletContext class and the AudioClip interface. Since applications don't have applet contexts, they have no easy way to play audio clips
How Do I Play A Sound In An Application?
Java Interview Questions
Java Interview Questions for java programmers !
Java Interview Questions
Java Games For Your Cell Phone
Are you one of those people who get tired when standing in queue? Can't stop multitasking no matter what you do
Java Games For Your Cell Phone
Pros And Cons Of JavaScript
Javascript use is very common across the Internet; but just because it is popular, does that mean you should use it for your site
Pros And Cons Of JavaScript
Tag Libraries
JSP 1.1 introduces a method of extending JSP tags, called "tag libraries".
Tag Libraries
Beans And Form Processing
The standard way of handling forms in JSP is to define a "bean". This is not a full Java bean.
Beans And Form Processing
JSP Sessions
If you are programming the site, it is very helpful to be able to associate some data with each visitor. For this purpose, "session"s can be used in JSP
JSP Sessions
JSP Tags
Another important syntax element of JSP are tags. JSP tags do not use <%, but just the < character. A JSP tag is somewhat like an HTML tag.
JSP Tags
JSP Directives
We have been fully qualifying the java.util.Date in the examples in the previous sections. Perhaps you wondered why we don't just import java.util.*;
JSP Directives
Mixing Scriptlets And HTML
We have already seen how to use the "out" variable to generate HTML output from within a scriptlet.
Mixing Scriptlets And HTML
JSP:Scriptlets
JSP also allows you to write blocks of Java code inside the JSP. You do this by placing your Java code between <% and %> characters
JSP:Scriptlets
Categories
Related Links

 

Java4Programmers.com

Java4Programmers.com This is a high-level informational site for java programmers outside of Sun Microsystems. This is a categorized directory of information sources for Java, including sources, communities, tools, etc.

Java Script

Java Script : Download Free Java Script

 

Here are some useful free java scripts !!!!

1. This countdown script prints directly to the page, displaying the time left in minutes and seconds. The time duration can be set in the script. The timer will automatically stop when the time reaches 00 minutes and 00 seconds.

01 min and 17 sec

Countdown timer:

var sec = 30; // set the seconds
var min = 02; // set the minutes

function countDown() {
sec--;
if (sec == -01) {
sec = 59;
min = min - 1;
} else {
min = min;
}
if (sec<=9) { sec = "0" + sec; }
time = (min<=9 ? "0" + min : min) + " min and " + sec + " sec ";
if (document.getElementById) { theTime.innerHTML = time; }
SD=window.setTimeout("countDown();", 1000);
if (min == '00' && sec == '00') { sec = "00"; window.clearTimeout(SD); }
}

function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent(function() {
countDown();
});

===============================================

2. This script will allow you to limit the number of words and/or characters entered into a form. Easily customizable.

/* For additional information about this JavaScript
and how to use it, see the "Displaying Number of Words
Typed Into Form Fields" article, linked from the archives
at from http://willmaster.com/possibilities/archives/
The above note and the copyright line must remain with
this JavaScript source code. Comments below this point
in the code may be removed if desired.

// Customizing this JavaScript code requires specifying eight values.

// Value One:
// Specify the maximum number of characters the form field
// may contain. If you have no maximum, specify 0 (zero).

var MaximumCharacters = "80";

// Value Two:
// Specify the maximum number of words the form field may
// contain. If you have no maximum, specify 0 (zero).

var MaximumWords = "16";

// Value Three:
// Specify the form's name (provided by the name="_____"
// attribute in the FORM tag).

var FormName = "myForm";

// Value Four:
// Specify the name of the text field being monitored
// (provided by the name="_____" attribute in the
// INPUT or TEXTARE tag).

var TextFieldName = "TextField";

// Value Five:
// Specify the field name where where is to be displayed
// the number of characters the user has typed. Make
// it blank (nothing between the quotation marks) if
// you aren't displaying the number of characters typed.

var CharactersTypedFieldName = "CharsTyped";

// Value Six:
// Specify the field name where where is to be displayed
// the number of characters left that may be typed.
// Make it blank (nothing between the quotation marks)
// if you aren't displaying the number of characters
// left.

var CharactersLeftFieldName = "CharsLeft";

// Value Seven:
// Specify the field name where where is to be displayed
// the number of words the user has typed. Make it
// blank (nothing between the quotation marks) if you
// aren't displaying the number of words typed.

var WordsTypedFieldName = "WordsTyped";

// Value Eight:
// Specify the field name where where is to be displayed
// the number of words left that may be typed. Make it
// blank (nothing between the quotation marks) if you
// aren't displaying the number of words left.

var WordsLeftFieldName = "WordsLeft";

//////////////////////////////////////////////////////
// //
// No modfications are required below this point. //
// //
//////////////////////////////////////////////////////

var WordsMonitor = 0;
var MaxWords = parseInt(MaximumWords);
var MaxChars = parseInt(MaximumCharacters);
var textfield = 'document.' + FormName + '.' + TextFieldName + '.value';

function WordLengthCheck(s,l) {
WordsMonitor = 0;
var f = false;
var ts = new String();
for(var vi = 0; vi < s.length; vi++) {
vs = s.substr(vi,1);
if((vs >= 'A' && vs <= 'Z') || (vs >= 'a' && vs <= 'z') || (vs >= '0' && vs <= '9')) {
if(f == false) {
f = true;
WordsMonitor++;
if((l > 0) && (WordsMonitor > l)) {
s = s.substring(0,ts.length);
vi = s.length;
WordsMonitor--;
}
}
}
else { f = false; }
ts += vs;
}
return s;
} // function WordLengthCheck()

function CharLengthCheck(s,l) {
if(s.length > l) { s = s.substring(0,l); }
return s;
} // function CharLengthCheck()

function InputCharacterLengthCheck() {
if(MaxChars <= 0) { return; }
var currentstring = new String();
eval('currentstring = ' + textfield);
var currentlength = currentstring.length;
eval('currentstring = CharLengthCheck(' + textfield + ',' + MaxChars + ')');
if(CharactersLeftFieldName.length > 0) {
var left = 0;
eval('left = ' + MaxChars + ' - ' + textfield + '.length');
if(left < 0) { left = 0; }
eval('document.' + FormName + '.' + CharactersLeftFieldName + '.value = ' + left);
if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
}
if(CharactersTypedFieldName.length > 0) {
eval('document.' + FormName + '.' + CharactersTypedFieldName + '.value = ' + textfield + '.length');
if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
}
} // function InputCharacterLengthCheck()

function InputWordLengthCheck() {
if(MaxWords <= 0) { return; }
var currentstring = new String();
eval('currentstring = ' + textfield);
var currentlength = currentstring.length;
eval('currentstring = WordLengthCheck(' + textfield + ',' + MaxWords + ')');
if (WordsLeftFieldName.length > 0) {
var left = MaxWords - WordsMonitor;
if(left < 0) { left = 0; }
eval('document.' + FormName + '.' + WordsLeftFieldName + '.value = ' + left);
if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
}
if (WordsTypedFieldName.length > 0) {
eval('document.' + FormName + '.' + WordsTypedFieldName + '.value = ' + WordsMonitor);
if(currentstring.length < currentlength) { eval(textfield + ' = currentstring.substring(0)'); }
}
} // function InputWordLengthCheck()

function InputLengthCheck() {
InputCharacterLengthCheck();
InputWordLengthCheck();
} // function InputLengthCheck()

===============================================


3. Sometimes you want a single hyperlink to lead to several pages and present a dynamic menu when clicked. This is usually done through an intermediary page. This script will provide a dynamic menu by creating an absolutely-positioned DIV tag on the fly, which will contain the list of links.

// Moves the div object to be directly beneath an object.
function move_box(an, box) {
var cleft = 0;
var ctop = 0;
var obj = an;

while (obj.offsetParent) {
cleft += obj.offsetLeft;
ctop += obj.offsetTop;
obj = obj.offsetParent;
}

box.style.left = cleft + 'px';
ctop += an.offsetHeight + 8;

// Handle Internet Explorer body margins,
// which affect normal document, but not
// absolute-positioned stuff.
if (document.body.currentStyle && document.body.currentStyle['marginTop']) {
ctop += parseInt(document.body.currentStyle['marginTop']);
}
box.style.top = ctop + 'px';
}

// Shows a box if it wasn't shown yet or is hidden
// or hides it if it is current
function show_hide_multilink(an, width, height, className, links) {
var href = an.href;
var boxdiv = document.getElementById(href);
if (boxdiv != null) {
if (boxdiv.style.display=='none') {
// Show existing box, move it
// if document changed layout
move_box(an, boxdiv);
boxdiv.style.display='block';
}
else
// Hide currently shown box.
boxdiv.style.display='none';
return false;
}

// Create box object through DOM
boxdiv = document.createElement('div');

// Assign id equalling to the document it will show
boxdiv.setAttribute('id', href);
boxdiv.className = className;
boxdiv.style.position = 'absolute';
boxdiv.style.width = width + 'px';
boxdiv.style.height = height + 'px';

var linksarr = links.split(';');
var liobj;
var anchorobj;
for (var i = 0; i < linksarr.length; i = i + 2) {
liobj = document.createElement('li');
liobj.className = className;
anchorobj = document.createElement('a');
anchorobj.classname=className;
anchorobj.href = linksarr[i];
anchorobj.target = '_top';
anchorobj.appendChild(document.createTextNode(linksarr[i + 1]));
liobj.appendChild(anchorobj);
boxdiv.appendChild(liobj);
}

document.body.appendChild(boxdiv);
move_box(an, boxdiv);

// The script has successfully shown the box,
// prevent hyperlink navigation.
return false;
}

========================================


4. Your visitors may not be familiar with style sheets for printing and don't see a 'print preview' in their browser. This script will provide them with a reliable print preview.


function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}

addLoadEvent( function(){ add_print_link( 'nav' ) } );

function add_print_link( id ){
if( !document.getElementById ||
!document.getElementById( id ) ) return;

// add extra functions to page tools list
var print_page = document.getElementById( id );

// create print link
var print_function = document.createElement('p');
print_function.className = 'print-link';
print_function.onclick = function(){ print_preview(); return false; };
print_function.appendChild( document.createTextNode( 'Print the Page' ) );

}

function print_preview() {
// Switch the stylesheet
setActiveStyleSheet('Print Preview');

// Create preview message
add_preview_message();

// Print the page
window.print();
}

function add_preview_message(){
var main_content = document.getElementById('content');
var main_body = main_content.parentNode;

if (document.getElementById){

var preview_message = document.createElement('div');
preview_message.id = 'preview-message';

// Create Heading
var preview_header = document.createElement('h3');
var preview_header_text = document.createTextNode('This is a print preview of this page');
preview_header.appendChild(preview_header_text);

// Create paragraph
var preview_para = document.createElement('p');
var preview_para_text = document.createTextNode('Without this message of course. ');

var cancel_function_link = document.createElement('a');
cancel_function_link.onclick = function(){ cancel_print_preview(); return false; };
cancel_function_link.setAttribute('href', '#');
var cancel_function_link_text = document.createTextNode('Return to the existing page.');
cancel_function_link.appendChild(cancel_function_link_text);
preview_para.appendChild(preview_para_text); //
preview_para.appendChild(cancel_function_link);

// Put it all toegether
preview_message.appendChild(preview_header);
preview_message.appendChild(preview_para);
main_body.insertBefore(preview_message, main_content);

}
}

function cancel_print_preview() {
// Destroy the preview message
var print_preview = document.getElementById('preview-message');
var main_body = print_preview.parentNode;
main_body.removeChild(print_preview);

// Switch back stylesheet
setActiveStyleSheet('default');
}

function setActiveStyleSheet(title) {
var i, a, main;
for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
if(a.getAttribute("rel").indexOf("style") != -1
&& a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
}
}
}
==============================================

More Coming !


Other Relevant Articles from this Category:
Definitive Guide Java Script
Download Java Script
Download Free Java Script
Pros And Cons Of JavaScript
Javascript Is Not Java
Of CGI And Java Scripts
How To Call Java Applet Functions From Javascript

More Categories:
Java Script  
Download Java  
Java Game  
Java Programming  
Java Developer  
Java Certification  
Java Applet  
Java Sun Certification  
Java Tutorial  
Java Swing  
Java Runtime Environment  
Xml  
Install Java  
Java Network Programming  
Java Training  
J2ee  
Thinking In Java  
Java Application Server  
Java Programmer  
Java Design Pattern  
Tomcat  
Struts  
Jsp