-
How to load JavaScript like a WordPress Master
WordPress - an open source powerful PHP platform to develop personal web blogs, WordPress is the most used blog system at present, and I also opened a personal blog base ... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Amazing Bounce Effect using jQuery framework
JavaScript bounce effect is the type of script presented on jsB@nk.com through many plained-JavaScript example codes, such as:
- [URL="http://www.javascriptbank.com/elastic-trail-script.html"]J... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Copy & Paste CSS code below in your HEAD section
CSS
Code:
<STYLE type="text/css">
body, input{
font-family: Calibri, Arial;
}
div {
padding:5px;
width:150px;
height:100px;
text-align:center;
}
#bouncy1 {
background-color:#FFEE88;
}
#bouncy2 {
background-color:#EE88FF;
}
#bouncy3 {
background-color:#EE8888;
}
#bouncy4 {
background-color:#88EEFF;
}
</STYLE>
Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js"></script>
<SCRIPT>
$(function(){
//Add bounce effect on Click of the DIV
$('#bouncy1').click(function () {
$(this).effect("bounce", { times:5 }, 300);
});
$('#bouncy2').click(function () {
$(this).effect("bounce", { direction:'left', times:5 }, 300);
});
$('#bouncy3').click(function () {
$(this).effect("bounce", { direction:'right', times:5 }, 300);
});
$('#bouncy4').click(function () {
$(this).effect("bounce", { direction:'down', times:5 }, 300);
});
//Bounce all DIVs on click of button
$("#bounceAll").click(function(){
$("div").click();
});
});
</SCRIPT>
Step 3: Place HTML below in your BODY section
HTML
Code:
<table>
<tr>
<td><div id="bouncy1">Click here to bounce. Direction: Up</div></td>
<td><div id="bouncy2">Click here to bounce. Direction: Left</div></td>
</tr>
<tr>
<td><div id="bouncy3">Click here to bounce. Direction: Right</div></td>
<td><div id="bouncy4">Click here to bounce. Direction: Down</div></td>
</tr>
</table>
<br/>
<input id="bounceAll" type="button" value="Click to Bounce All!"/>
-
Encapsulation in OOP JavaScript
Encapsulation is a very useful technique in Object-Oriented programming which allows you to separate an abstraction's implementation from its interface class, thus enabling future changes to the imple... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
45 Great Helpful JavaScript and jQuery Techniques and Tools
Yes, this free HTML JavaScript tutorial is another round-up of very great and helpful JavaScript/jQuery techniques, tools and resources. In this selection we presen... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Training Lexical Structure and Statements
This free HTML JavaScript tutorial provides some basic JavaScript concepts for programming newbies. In this post, you will train some categories of JavaScript sta... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
65 Free JavaScript Photo Gallery Solutions
-
Smash a Smiley 1.2
Similar to the free JavaScript game Whack the Gopher, this JavaScript game is simpler by change the picture of gophers into the ... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script language="Javascript">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
<!--
/*
SMASH a SMILEY 1.2
---------------------------------------------------------------------
Copyright 1997 Tomas Lilje
http://home3.swipnet.se/~w-39426 || e.lilje@swipnet.se
Use this script if you want but don´t put
away this clip, and please drop me
a note. Email comments etc. too
*/
function eraone () {
document.play.first.value="";
}
function eratwo () {
document.play.second.value="";
}
function erathree () {
document.play.third.value="";
}
function erafour () {
document.play.fourth.value="";
}
function erafive () {
document.play.fifth.value="";
}
function erasix () {
document.play.sixth.value="";
}
function eraseven () {
document.play.seventh.value="";
}
function eraeight () {
document.play.eighth.value="";
}
function eranine () {
document.play.ninth.value="";
}
function start () {
document.play.fourth.value=" :-)";
document.play.third.value=" ;-o";
setTimeout("nextone ()",500);
}
function nextone () {
document.play.fourth.value="";
document.play.fifth.value="d:-D";
setTimeout("nexttwo ()",400);
}
function nexttwo () {
document.play.third.value="";
setTimeout("nextthree()",400);
}
function nextthree () {
document.play.seventh.value=":-(";
document.play.first.value=">:-)";
document.play.sixth.value="B-)";
setTimeout("nextfour ()",700);
}
function nextfour () {
document.play.first.value="";
document.play.sixth.value="";
document.play.second.value="=)";
setTimeout("nextfive ()",700);
}
function nextfive () {
document.play.seventh.value="";
document.play.second.value="";
document.play.fourth.value="[:o]";
setTimeout("nextsix ()",800);
}
function nextsix () {
document.play.eighth.value="d:-(";
document.play.second.value=">:-D";
setTimeout("nextseven ()",700);
}
function nextseven () {
document.play.eighth.value="";
document.play.fifth.value=":-)";
setTimeout("nexteight ()",400);
}
function nexteight () {
document.play.ninth.value=";-)"
document.play.fourth.value=":<0";
setTimeout("nextnine ()",500);
}
function nextnine () {
document.play.fifth.value="";
document.play.fourth.value="";
document.play.first.value=":-v";
setTimeout("nextten ()",200);
}
function nextten () {
document.play.third.value="B-)";
document.play.sixth.value=":-(";
setTimeout("nexteleven ()",600);
}
function nexteleven () {
document.play.first.value="";
document.play.seventh.value=";-(";
setTimeout("nexttwelve ()",500);
}
function nexttwelve () {
document.play.second.value="B-o";
document.play.ninth.value=";-(";
setTimeout("nextthirteen ()",700);
}
function nextthirteen () {
document.play.first.value=":-)";
document.play.ninth.value="";
document.play.seventh.value="";
setTimeout("start ()",600);
}
function stop () {
document.play.first.value="";
document.play.second.value="";
document.play.third.value="";
document.play.fourth.value="";
document.play.fifth.value="";
document.play.sixth.value="";
document.play.seventh.value="";
document.play.eighth.value="";
document.play.ninth.value="";
}
function about() {
alert("Smash a Smiley 1.2 is written by Tomas Lilje. You can use this game if you want, but don´t modify it, and please drop me a note. For further versions, please visit TNeT. Email-> e.lilje@swipnet.se TNeT-> http://home3.swipnet.se/~w-39426");
}
function help() {
alert("How to play: Your mission is to hit the smileys, when they show up. ");
}
//-->
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<!--
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
-->
<table border=8 bgcolor="midnightblue" cellpadding=0 cellspacing=0>
<tr>
<td>
<form name="play">
<center>
<font face="Arial" color="FANTASY" size="4">
<b>Smash a Smiley 1.2
<hr>
<INPUT TYPE="button" NAME="first" OnClick="eraone ()" value=" ">
<INPUT TYPE="button" NAME="second" OnClick="eratwo ()" value=" ">
<INPUT TYPE="button" NAME="third" OnClick="erathree ()" value=" ">
<br>
<INPUT TYPE="button" NAME="fourth" OnClick="erafour ()" value=" ">
<INPUT TYPE="button" NAME="fifth" OnClick="erafive ()" value=" ">
<INPUT TYPE="button" NAME="sixth" OnClick="erasix ()" value=" ">
<br>
<INPUT TYPE="button" NAME="seventh" OnClick="eraseven ()" value=" ">
<INPUT TYPE="button" NAME="eighth" OnClick="eraeight ()" value=" ">
<INPUT TYPE="button" NAME="ninth" OnClick="eranine ()" value=" ">
<br>
<hr>
<INPUT TYPE="button" NAME="startitup" OnClick="start ()" value=" Start ">
<input type="button" name="hbutton" value=" Help" onclick="help()">
<input type="button" name="abutton" value=" About" onclick="about()">
<br>
<hr>
<font size="2">Copyright 1997 Tomas Lilje
</form>
</td>
</tr>
</table>
-
Strip HTML tags in Rails, JavaScript and PHP
In this HTML JavaScript tutorial, <i>Brijesh Shah</i> guides you create some simple codes in Rails, JavaScript and PHP to strip HTML tags, detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
A Basic AJAX Demo Application Using PHP And JavaScript
This free AJAX JavaScript tutorial guides you how to build a simple AJAX application using PHP and JavaScript. This free HTMl JavaScript tutorial provides y... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Marking your Sheet Music Notation with JavaScript
One more wonderful JavaScript web application created by JavaScript developers, web developers. That is [URL="http://www.javascriptbank.com/tag=sheet music notation"]sheet music no... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Copy & Paste CSS code below in your HEAD section
CSS
Code:
<style type="text/css">
canvas{
display:block;
border:1px solid #000;
width:100%;
height:300px;
}
</style>
Step 2: Place JavaScript below in your HEAD section
JavaScript
Code:
<script src="canvastext.js"></script>
<script src="ellipse.js"></script>
<script src="notation-viewer.js"></script>
<script src="/javascript/jquery.js"></script>
<script src="js.js"></script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<form method="post"><select id="file_chooser" name="file"><option>0001 - john w schaum - at sea level</option><option selected="selected">0002 - john w schaum - seize the cs</option></select><select id="zoom"><option value="2">200%</option><option value="1.5">150%</option><option value="1" selected="selected">100%</option><option value=".8">80%</option><option value=".5">50%</option></select></form><canvas id="canvas"></canvas><script>var music={sp:{"work":"","part-list":{"score-part":{_a:{"id":"P1"},"part-name":"Staff 1","score-instrument":{_a:{"id":"P1-I1"},"instrument-name":"Piano 1"},"midi-instrument":{_a:{"id":"P1-I1"},"midi-channel":"1","midi-program":"1"}}},pa:{_a:{"id":"P1"},me:[{_a:{nu:1},at:{di:"1","key":{"fifths":"0"},ti:"4/4",cl:"F/4"},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}]},{_a:{nu:2},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}]},{_a:{nu:3},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"}]},{_a:{nu:4},no:[{pi:{s:5,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}]},{_a:{nu:5},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}]},{_a:{nu:6},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}]},{_a:{nu:7},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:5,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"}]},{_a:{nu:8},no:[{pi:{s:0,o:4},d:1,v:1,t:4,"stem":"down"},{pi:{s:6,o:3},d:1,v:1,t:4,"stem":"down"},{pi:{s:0,o:4},d:2,v:1,t:2,"stem":"down"}],"barline":{_a:{"location":"right"},"bar-style":"light-heavy"}}]}}};</script>
Step 4: downloads
Files
canvastext.js
ellipse.js
jquery.js
js.js
notation-viewer.js
-
Automating Tasks with Windows Script Host and JScript JavaScript
This free HTML JavaScript tutorial guides you how to create some simple automating tasks on your computer with Windows Script Host (WSH) and JScript JavaScript, without any third part software. Please... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Essential jQuery Examples for Web Designers
jQuery is becoming more important than we think, although it's just JavaScript framework to help web coders, web programmers write the interactive tasks. However, with the higher requirements of moder... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Simple JavaScript Chat Box with OOP Skill
This JavaScript code example (JavaScript chat code) just help you learn more OOP in JavaScript by making a message box with chat-style window. A simple free JavaScript chat effect with a few codelines... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
div#list {
background-color: #DFDFDF;
color: #000;
overflow: scroll;
width: 15em;
height: 10em;
padding: 10px;
text-align: left;
}
</style>
Step 2: Place JavaScript below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: James Robertson | http://www.r0bertson.co.uk
// This script downloaded from www.JavaScriptBank.com
function addText() {
olist = document.getElementById('list');
op = document.createElement('p');
op.innerHTML = 'More text ...';
ocontent = document.getElementById('content');
ocontent.appendChild(op);
olist.scrollTop = olist.scrollHeight;
}
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<p>A simple chat-style display</p>
<div id="list">
<div id="content">
<p class="other_user">Good afternoon. How are you?</p>
<p class="other_user">Hello?</p>
<p class="other_user">Is anybody there?</p>
</div>
</div>
<p>
<div id="toolbar"><input type="button" value="add text" onclick="addText()" /></div>
-
Awesome JavaScript Image Rotator with jQuery
This is an awesome image rotator JavaScript using jQuery to perform animation, with a little of CSS for styling. You can also use this detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
body {
margin: 0; padding: 0;
font: 10px normal Arial, Helvetica, sans-serif;
}
* {margin: 0; padding: 0; outline: none;}
img {border: none;}
fieldset h1 {
font: 3em normal Georgia, "Times New Roman", Times, serif;
color: #fff;
text-align: center;
background: url(h1_bg.gif) no-repeat;
text-indent: -99999px;
margin: 100px 0 10px;
}
.container {
overflow: hidden;
width: 900px;
margin: 0 auto;
}
#main {
padding: 10px;
background: #f0f0f0;
border: 1px solid #ccc;
}
fieldset a {color: #fff;}
/*--Main Image Preview--*/
.main_image {
width: 598px; height: 456px;
float: left;
background: #333;
position: relative;
overflow: hidden;
color: #fff;
}
.main_image h2 {
font-size: 2em;
font-weight: normal;
margin: 0 0 5px; padding: 10px;
}
.main_image p {
font-size: 1.2em;
padding: 10px; margin: 0;
line-height: 1.6em;
}
.block small {
padding: 0 0 0 20px;
background: url(icon_calendar.gif) no-repeat 0 center;
font-size: 1em;
}
.main_image .block small {margin-left: 10px;}
.main_image .desc{
position: absolute;
bottom: 0; left: 0;
width: 100%;
display: none;
}
.main_image .block{
width: 100%;
background: #111;
border-top: 1px solid #000;
}
.main_image a.collapse {
background: url(btn_collapse.gif) no-repeat left top;
height: 27px; width: 93px;
text-indent: -99999px;
position: absolute;
top: -27px; right: 20px;
}
.main_image a.show {background-position: left bottom;}
.image_thumb {
float: left;
width: 299px;
background: #f0f0f0;
border-right: 1px solid #fff;
border-top: 1px solid #ccc;
}
.image_thumb img {
border: 1px solid #ccc;
padding: 5px;
background: #fff;
float: left;
}
.image_thumb ul {
margin: 0; padding: 0;
list-style: none;
}
.image_thumb ul li{
margin: 0; padding: 12px 10px;
background: #f0f0f0 url(nav_a.gif) repeat-x;
width: 279px;
float: left;
border-bottom: 1px solid #ccc;
border-top: 1px solid #fff;
border-right: 1px solid #ccc;
}
.image_thumb ul li.hover {
background: #ddd;
cursor: pointer;
}
.image_thumb ul li.active {
background: #fff;
cursor: default;
}
html .image_thumb ul li h2 {
font-size: 1.5em;
margin: 5px 0; padding: 0;
}
.image_thumb ul li .block {
float: left;
margin-left: 10px;
padding: 0;
width: 170px;
}
.image_thumb ul li p{display: none;}
</style>
Step 2: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript" src="/javascript/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {
//Show Banner
$(".main_image .desc").show(); //Show Banner
$(".main_image .block").animate({ opacity: 0.85 }, 1 ); //Set Opacity
//Click and Hover events for thumbnail list
$(".image_thumb ul li:first").addClass('active');
$(".image_thumb ul li").click(function(){
//Set Variables
var imgAlt = $(this).find('img').attr("alt"); //Get Alt Tag of Image
var imgTitle = $(this).find('a').attr("href"); //Get Main Image URL
var imgDesc = $(this).find('.block').html(); //Get HTML of block
var imgDescHeight = $(".main_image").find('.block').height(); //Calculate height of block
if ($(this).is(".active")) { //If it's already active, then...
return false; // Don't click through
} else {
//Animate the Teaser
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 , function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
});
}
$(".image_thumb ul li").removeClass('active'); //Remove class of 'active' on all lists
$(this).addClass('active'); //add class of 'active' on this list only
return false;
}) .hover(function(){
$(this).addClass('hover');
}, function() {
$(this).removeClass('hover');
});
//Toggle Teaser
$("a.collapse").click(function(){
$(".main_image .block").slideToggle();
$("a.collapse").toggleClass("show");
});
});//Close Function
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<div id="main" class="container">
<div class="main_image">
<img src="banner5.jpg" alt="Puzzled Putter">
<div style="display: block;" class="desc">
<a href="#" class="collapse">Close Me!</a>
<div style="opacity: 0.85; margin-bottom: 0px; display: block;" class="block">
<h2>Puzzled Putter</h2>
<small>04/14/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et. <br><a href="http://store.glennz.com/puzzledputter.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</div>
</div>
<div class="image_thumb">
<ul>
<li class="">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner1.jpg"><img src="banner1_thumb.jpg" alt="Slowing Dow"></a>
<div class="block">
<h2>Slowing Down</h2>
<small>04/10/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et.<br><a href="http://store.glennz.com/slowingdown.html" target="_blank">Artwork By Glenn Jones</a> </p>
</div>
</li>
<li class="">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner2.jpg"><img src="banner2_thumb.jpg" alt="Organized Food Fight"></a>
<div class="block">
<h2>Organized Food Fight</h2>
<small>04/11/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et. Autem conventio nimis quis ad, nisl secundum sed,
facilisi, vicis augue regula, ratis, autem. Neo nostrud letatio aliquam
validus eum quadrum, volutpat et.</p>
<p>Autem conventio nimis
quis ad, nisl secundum sed, facilisi, vicis augue regula, ratis, autem.
Neo nostrud letatio aliquam validus eum quadrum, volutpat et.<br><a href="http://store.glennz.com/orfofi.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</li>
<li class="">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner3.jpg"><img src="banner3_thumb.jpg" alt="Endangered Species"></a>
<div class="block">
<h2>Endangered Species</h2>
<small>04/12/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et.<br><a href="http://store.glennz.com/ensp.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</li>
<li class="">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner4.jpg"><img src="banner4_thumb.jpg" alt="Evolution"></a>
<div class="block">
<h2>Evolution</h2>
<small>04/13/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et. Autem conventio nimis quis ad, nisl secundum sed,
facilisi, vicis augue regula, ratis, autem. Neo nostrud letatio aliquam
validus eum quadrum, volutpat et.<br><a href="http://store.glennz.com/evolution.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</li>
<li class="active hover">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner5.jpg"><img src="banner5_thumb.jpg" alt="Puzzled Putter"></a>
<div class="block">
<h2>Puzzled Putter</h2>
<small>04/14/09</small>
<p>Autem
conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue
regula, ratis, autem. Neo nostrud letatio aliquam validus eum quadrum,
volutpat et. <br><a href="http://store.glennz.com/puzzledputter.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</li>
<li class="">
<a href="http://www.sohtanaka.com/web-design/examples/image-rotator/banner6.jpg"><img src="banner6_thumb.jpg" alt="Secret Habit"></a>
<div class="block">
<h2>Secret Habit</h2>
<small>04/15/09</small>
<p>Autem conventio nimis quis ad, nisl secundum sed, facilisi, vicis augue regula, ratis, autem.<br><a href="http://store.glennz.com/secrethabit1.html" target="_blank">Artwork By Glenn Jones</a></p>
</div>
</li>
</ul>
</div>
</div>
-
Simple JavaScript Typing Text onClick
With this JavaScript typing text script, you can use to spell out a string of text, letter by letter. This JavaScript code example provides 3 ways to type our st... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Ilya Gerasimenko | http://www.gerasimenko.com
// This script downloaded from www.JavaScriptBank.com
// Text to type
var stringOfText1 = '... with a new string of text. Convenient for those "read more..." links.';
var stringOfText2 = ' spots on the same page; the animations will be consecutive.';
var stringOfText3 = 'Click (and keep clicking) here to retype this text over and over. You don\'t have to, but you can.';
// Animation
var textHolder;
var textTarget;
var letter;
var index;
var printing;
var waiting = false;
// Start
spellString = function (oId,str) {
if (waiting == false) {
index = 0;
waiting = true;
textTarget = document.getElementById(oId);
textTarget.innerHTML = '';
textHolder = str.split('');
sendToPrint();
}
}
// Animation
sendToPrint = function () {
if (index<textHolder.length) {
printing = window.setTimeout(
function () {
getLetter(textTarget,index);
}, 1);
} else {
waiting = false;
}
}
getLetter = function (textTarget,index) {
letter = document.createTextNode(textHolder[index]);
if (letter.value == '\\') letter.value = '';
printLetter(textTarget,letter);
}
printLetter = function (textTarget,letter) {
textTarget.appendChild(letter);
window.clearTimeout(printing);
index++;
sendToPrint();
}
// Created by: Simon Willison | http://simon.incutio.com/
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 () {
document.getElementById('clickhere1').onclick = function () {
spellString('typehere1',stringOfText1);
}
document.getElementById('clickhere2').onclick = function () {
spellString('typehere2',stringOfText2);
}
document.getElementById('keepclicking').onclick = function () {
spellString('keepclicking',stringOfText3);
}
}
);
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<!--
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
-->
<div style="text-align: left; width: 70%;">
<p id="typehere1"><span id="clickhere1">Click here to <em>replace</em> this text ...</span></p>
<p>Can be used in several<span id="typehere2">... <span id="clickhere2">(click here to <em>read more</em>)</span></span></p>
<p id="keepclicking">Click (and keep clicking) here to <em>retype this text over and over</em>.</p>
</div>
-
AJAX Basics for Beginners
In this AJAX JavaScript article tutorial, the author shows you some basics about AJAX (Asynchronous JavaScript and XML), such as: methods and properties of AJAX, how to send a request to server with G... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Simple JavaScript Number Formatter
This JavaScript code example provides us two functions to clean up and format numbers quite nicely.
One JavaScript check number function will take any decima... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Justin Barlow | http://www.netlobo.com/
// This script downloaded from www.JavaScriptBank.com
// This function formats numbers by adding commas
function numberFormat(nStr){
nStr += '';
x = nStr.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return x1 + x2;
}
// This function removes non-numeric characters
function stripNonNumeric( str ){
str += '';
var rgx = /^\d|\.|-$/;
var out = '';
for( var i = 0; i < str.length; i++ ){
if( rgx.test( str.charAt(i) ) ){
if( !( ( str.charAt(i) == '.' && out.indexOf( '.' ) != -1 ) ||
( str.charAt(i) == '-' && out.length != 0 ) ) ){
out += str.charAt(i);
}
}
}
return out;
}
</script>
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<div>
numberFormat():<br>
<form method="get" onsubmit="javascript:return false;">
<input type="text" onkeyup="javascript:document.getElementById('numFormatResult').innerHTML = numberFormat( this.value );">
<input type="reset" value="clear">
</form>
<span id="numFormatResult"></span>
<br><br>
stripNonNumeric():<br>
<form method="get" onsubmit="javascript:return false;">
<input type="text" onkeyup="javascript:document.getElementById('numStripResult').innerHTML = stripNonNumeric( this.value );">
<input type="reset" value="clear">
</form>
<span id="numStripResult"></span>
<br><br>
stripNonNumeric() then numberFormat():<br>
<form method="get" onsubmit="javascript:return false;">
<input type="text" onkeyup="javascript:document.getElementById('numBothResult').innerHTML = numberFormat( stripNonNumeric( this.value ) );">
<input type="reset" value="clear">
</form>
<span id="numBothResult"></span>
</div>
-
Better JavaScript Minification
JavaScript minify (JS minify) is one of most important tasks if you would like to care about web performance. Today, jsB@nk would like to shows you a JavaScript article tutor... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
HOT New JavaScript APIs with HTML5
In this JavaScript article tutorial, we're together to enjoy awesome experiments on HTML5 with new hot JavaScript APIs. With a lot of JavaScript/Web application live demos in this JavaScript HTML5 tut... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Amazing and Cool HTML Tooltips with JavaScript-jQuery
HTML tooltips are the indispensable things on the layout of any website. They may provide more information to our readers without breaking the web designs. Most basic and ... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
WOW these are amazing... good fucking job and i love you <3
-
JavaScript Objects: Compare and Clone
This JavaScript article tutorial shows you a short overview about JavaScript objects in comparing and cloning. You'll know how to clone JavaScript objects, make... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
JavaScript Add More Unlimited Input Fields
The type of this JavaScript effect can be seen on many upload-allowance sites, such as Youtube, Flickr, ImageShack, Picasa, etc. That's your visitors can upload files through this JavaScript code, aft... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
#imageUpload input {
display: block;
}
</style>
Step 2: Place JavaScript below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Jeroen Haan | http://www.haan.net
// This script downloaded from JavaScriptBank.com
function fileFields() {
var x = document.getElementById('imageUpload');
x.onclick = function() {
var i = parseFloat(this.lastChild.id)+1;
input = document.createElement("input");
input.setAttribute("type", "file");
input.setAttribute("name", 'imageName_' + i);
input.setAttribute("id", i);
this.appendChild(input);
}
}
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
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() {
fileFields();
});
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<a href="#" id="imageUpload"><input type="file" name="imageName_1" id="1" /></a>
-
Browser Cookie with JavaScript and jQuery
This short JavaScript article tutorial guides you how to work with browser cookie, cookie in JavaScript by using the JavaScript framework jQuery, through some basi... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
JavaScript Color Gradient Maker
With this JavaScript code example, you can easy make CSS gradient background, [URL="http://www.javascriptbank.com/=JavaScript color gradient"]JavaScript color gradient</a... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Joseph Myers | http://www.codelib.net/
// This script downloaded from www.JavaScriptBank.com
function colorscale(hexstr, scalefactor) {
/* declared variables first, in order;
afterwards, undeclared local variables */
var r = scalefactor;
var a, i;
if (r < 0 || typeof(hexstr) != 'string')
return hexstr;
hexstr = hexstr.replace(/[^0-9a-f]+/ig, '');
if (hexstr.length == 3) {
a = hexstr.split('');
} else if (hexstr.length == 6) {
a = hexstr.match(/(\w{2})/g);
} else
return hexstr;
for (i=0; i<a.length; i++) {
if (a[i].length == 2)
a[i] = parseInt(a[i], 16);
else {
a[i] = parseInt(a[i], 16);
a[i] = a[i]*16 + a[i];
}
}
var maxColor = parseInt('ff', 16);
function relsize(a) {
if (a == maxColor)
return Infinity;
return a/(maxColor-a);
}
function relsizeinv(y) {
if (y == Infinity)
return maxColor;
return maxColor*y/(1+y);
}
for (i=0; i<a.length; i++) {
a[i] = relsizeinv(relsize(a[i])*r);
a[i] = Math.floor(a[i]).toString(16);
if (a[i].length == 1)
a[i] = '0' + a[i];
}
return a.join('');
}
function showrainbow(f) {
var colorcell, hex, i, nhex;
hex = f.orig.value;
hex = hex.replace(/\W/g, '');
nhex = colorscale(hex, f.scalef.value-0);
if (nhex != hex) {
f.outp.value = nhex;
colorcell = document.getElementById('origcolor');
i = document.getElementById('newcolor');
colorcell.style.background = '#' + hex;
i.style.background = '#' + nhex;
for (i=0; i<256; i++) {
colorcell = document.getElementById('colorcell'+i);
nhex = colorscale(hex, i/(256-i));
colorcell.style.background = '#' + nhex;
colorcell.nhexvalue = nhex;
}
}
}
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<div style="width: 400px;">
<form>
<p>
Original color: <input type="text" name="orig" value="339990"><br>
Scale factor: <input type="text" name="scalef" value="4"><br>
<input type="button" value="Output" onclick="showrainbow(this.form)">
<input type="text" readonly name="outp" style="border: none;">
</p>
</form>
<table width="150">
<tr>
<td width="50%" height="50" id="origcolor">Original</td>
<td width="50%" id="newcolor">New</td></tr>
</table>
<table cellpadding="0" cellspacing="0">
<tr>
<script type="text/javascript">
for (i=0; i<256; i++)
document.write('<td width="10" height="50" id="colorcell', i, '" onclick="document.forms[0].outp.value = this.nhexvalue"></td>');
</script>
</tr>
</table>
</div>
-
Built-in JavaScript RegEx APIs
Regular Expressions (RegEx) skills are the indispensable knowledges if you would like become a professional JavaScript coder particularly, or a professional programmer generally; because of a lot of p... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
JavaScript OOP with Input Display Toggle
Usage of this JavaScript code effect is just toggle (show/display) the input text fields when the users click the specified input checkboxes. But this JavaScript code example made with OOP skills, it'... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Fang | http://www.webdeveloper.com/forum/showthread.php?p=872326#post872326
// This script downloaded from www.JavaScriptBank.com
function addElement() {
var aInput=document.getElementById('myspan').getElementsByTagName('input');
for(var i=0; i<aInput.length; i++) {
aInput[i].onclick=new Function('addDelete(this)');
}
}
function addDelete(obj) {
var parentSpan=document.getElementById('myspan');
if(obj.nextSibling.nodeName!='INPUT') { // add
var oInputText=document.createElement('input');
oInputText.setAttribute('type', 'text');
parentSpan.insertBefore(oInputText, obj.nextSibling);
}
else { // delete
parentSpan.removeChild(obj.nextSibling);
}
}
// Multiple onload function created by: Simon Willison
// http://simonwillison.net/2004/May/26/addLoadEvent/
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() {
addElement();
});
</script>
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<span id="myspan">
<input type="checkbox">
<input type="checkbox">
<input type="checkbox">
</span>
-
50+ Great Web Applications of Data Visualization
Perhaps just read technical JavaScript article tutorials on jsB@nk made you become humdrum?! Today together, we should change the subject in this post, we'll enjoy 5... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
JavaScript Text Auto-Select onClick
If this JavaScript code example installed on a web page, when users click on text-container HTML elements then it will select all of its inner text automatically.
At present, this JavaScript code m... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Matt Murphy | http://www.matts411.com/
// This script downloaded from www.JavaScriptBank.com
function autoSelect(selectTarget) {
if(selectTarget != null && ((selectTarget.childNodes.length == 1
&& selectTarget.childNodes[0].nodeName == "#text") || (selectTarget.tagName == "INPUT"
&& selectTarget.type == "text"))) {
if(selectTarget.tagName == 'TEXTAREA' || (selectTarget.tagName == "INPUT" && selectTarget.type == "text")) {
selectTarget.select();
} else if(window.getSelection) { // FF, Safari, Opera
var sel = window.getSelection();
var range = document.createRange();
range.selectNode(selectTarget.firstChild);
sel.removeAllRanges();
sel.addRange(range);
} else { // IE
document.selection.empty();
var range = document.body.createTextRange();
range.moveToElementText(selectTarget);
range.select();
}
}
}
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<h4 style="margin-bottom: 0;">A <code>div</code> Element:</h4>
<div onclick="autoSelect(this);">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam ultrices vestibulum elit. Mauris congue sapien sed dolor. Pellentesque sem augue, porttitor id, placerat ac, congue ac, eros. Etiam fermentum consectetuer pede. Donec tincidunt. Suspendisse non nisi. In hac habitasse platea dictumst. In hac habitasse platea dictumst. Integer porta egestas sapien.
</div>
<h4 style="margin-bottom: 0;">An <code>input</code> Element:</h4>
<input type="text" size="50" onclick="autoSelect(this);" value="Lorem ipsum dolor sit amet, consectetuer adipiscing elit.">
<h4 style="margin-bottom: 0;">A <code>textarea</code> Element:</h4>
<textarea rows="5" cols="30" onclick="autoSelect(this);">
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nam ultrices vestibulum elit. Mauris congue sapien sed dolor. Pellentesque sem augue, porttitor id, placerat ac, congue ac, eros. Etiam fermentum consectetuer pede.
</textarea>
<h4 style="margin-bottom: 0;">A <code>pre</code> Element:</h4>
<pre onclick="autoSelect(this);">
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
e.style.display = 'block';
else
e.style.display = 'none';
}
</pre>
-
Use jQuery to Generate Random Strings
This short JavaScript article tutorial guides us how to make a random string with JavaScript (random string JavaScript) and jQuery. Both two detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Picture Gallery with Display Switcher
This is really very cool and amazing picture gallery to promote your personal/business pictures on the web. With two type of displaying, this JavaScript gallery script allow users to switch the layout... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: CSS below for styling thescript, place it into HEAD section
CSS
Code:
<style type="text/css">
body {
margin: 0;
padding: 50px 0 0;
font: 10px normal Verdana, Arial, Helvetica, sans-serif;
color: #fff;
}
* {
margin: 0;
padding: 0;
}
img {
border: none;
}
h1 {
font: 5em normal Georgia, 'Times New Roman', Times, serif;
text-align:center;
margin-bottom: 20px;
}
h1 span { color: #e7ff61; }
h1 small{
font: 0.2em normal Verdana, Arial, Helvetica, sans-serif;
text-transform:uppercase;
letter-spacing: 1.5em;
display: block;
color: #ccc;
}
.container {
width: 758px;
margin: 0 auto;
padding-bottom: 100px;
overflow: hidden;
}
ul.display {
float: left;
width: 756px;
margin: 0;
padding: 0;
list-style: none;
border-top: 1px solid #333;
border-right: 1px solid #333;
background: #222;
}
ul.display li {
float: left;
width: 754px;
padding: 10px 0;
margin: 0;
border-top: 1px solid #111;
border-right: 1px solid #111;
border-bottom: 1px solid #333;
border-left: 1px solid #333;
}
ul.display li a {
color: #e7ff61;
text-decoration: none;
}
ul.display li .content_block {
padding: 0 10px;
}
ul.display li .content_block h2 {
margin: 0;
padding: 5px;
font-weight: normal;
font-size: 1.7em;
}
ul.display li .content_block p {
margin: 0;
padding: 5px 5px 5px 245px;
font-size: 1.2em;
}
ul.display li .content_block a img{
padding: 5px;
border: 2px solid #ccc;
background: #fff;
margin: 0 15px 0 0;
float: left;
}
ul.thumb_view li{
width: 250px;
}
ul.thumb_view li h2 {
display: inline;
}
ul.thumb_view li p{
display: none;
}
ul.thumb_view li .content_block a img {
margin: 0 0 10px;
}
a.switch_thumb {
width: 122px;
height: 26px;
line-height: 26px;
padding: 0;
margin: 10px 0;
display: block;
background: url(switch.gif) no-repeat;
outline: none;
text-indent: -9999px;
}
a:hover.switch_thumb {
filter:alpha(opacity=75);
opacity:.75;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=75)";
}
a.swap { background-position: left bottom; }
</style>
Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript" src="/javascript/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("a.switch_thumb").toggle(function(){
$(this).addClass("swap");
$("ul.display").fadeOut("fast", function() {
$(this).fadeIn("fast").addClass("thumb_view");
});
}, function () {
$(this).removeClass("swap");
$("ul.display").fadeOut("fast", function() {
$(this).fadeIn("fast").removeClass("thumb_view");
});
});
});
</script>
Step 3: Copy & Paste HTML code below in your BODY section
HTML
Code:
<a href="javascript:void(0);" class="switch_thumb">Switch Thumb</a>
<ul style="display: block;" class="display">
<li>
<div class="content_block">
<a href="#"><img src="sample.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample2.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample3.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample4.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample5.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample6.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample7.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample8.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample9.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. Woman kickin', work yer last dogs, rattler hee-haw
mobilehome stew trailer driveway shootin'.</p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample10.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample11.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin', jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors spell. </p>
</div>
</li>
<li>
<div class="content_block">
<a href="#"><img src="sample12.gif" alt=""></a>
<h2><a href="#">Image Name</a></h2>
<p>Askin',
jehosephat come pudneer, sam-hell, in lament had. Cabin tax-collectors
spell, chitlins spittin' watchin' hootch me rightly kinfolk that. Woman
kickin', work yer last dogs, rattler hee-haw mobilehome stew trailer
driveway shootin'. </p>
</div>
</li>
</ul>
Step 4: must download files below
Files
Picture_Gallery_with_Display_Switcher_images.zip
-
JavaScript Proper Social Security Number Validation
One more JavaScript code example to accept numeric characters. But this JavaScript will work in the different manner, it on... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Mr. J | http://www.huntingground.net
// This script downloaded from www.JavaScriptBank.com
function advance2(currentField,nextField,limit) {
if(nextField!="rset"&&document.myForm2[currentField].value.length == limit){
document.myForm2[nextField].select();
} else {
if (document.myForm2[currentField].value.length == limit) {
document.myForm2[currentField].maxLength=limit
document.myForm2[nextField].select()
document.myForm2[nextField].disabled=false
document.myForm2[currentField].blur()
document.myForm2[nextField].style.backgroundColor="#EFCCA4"
}
}
}
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<p>
This form is formatted for a social security number (XXX-XX-XXXX).</p>
<form name="myForm2" onreset="this.rset.disabled='true'; this.rset.style.backgroundColor=''">
<input type="text" name="t1" size="6" onclick="select()" onKeyUp="advance2('t1','t2',3)">
<input type="text" name="t2" size="6" onclick="select()" onKeyUp="advance2('t2','t3',2)">
<input type="text" name="t3" size="6" onclick="select()" onKeyUp="advance2('t3','rset',4)">
<input type="reset" name="rset" onclick="this.blur()" disabled>
</form>
<div style="text-align: left; width: 70%;">
<p>
The limit for each individual field is passed to the function by the appropriate input event, as shown in the form using the format: <code>onKeyUp="advance2('currentField','nextField',limit)</code>"</p>
</div>
-
JavaScript Content Auto-Indexing using DOM
On the web pages with a lot of text content such as technical documents, novels, text stories, reportages, etc; usually we have to create the bookrmarks (anchor links) manuallly. Now these time-consum... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
.hidden {
visibility: hidden;
}
</style>
Step 2: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Stuart Langridge | http://www.kryogenix.org/ | Licensed under: MIT License
// This script downloaded from www.JavaScriptBank.com
/*
Generate a table of contents, based on headings in the page.
To place the TOC on the page, add
<div id="generated-toc"></div>
to the page where you want the TOC to appear. If this element
is not present, the TOC will not appear.
The TOC defaults to displaying all headings that are contained within
the same element as it itself is contained in (or all headings on the
page if you did not provide a generated-toc container). To override this,
provide a "highest heading" value by adding class="generate_from_h3"
(or h2, h4, etc) to the container. (If unspecified, this will display all
headings, as if class="generate_from_h1" was specified.)
The TOC defaults to operating only on headings contained within the same
element as it itself, i.e., in a page like this:
<div>
<div>
<div id="generated-toc"></div>
<h1>foo</h1>
<h2>bar</h2>
</div>
<h1>quux</h1>
</div>
The "quux" heading will not appear in the TOC. To override this,
add class="generate_for_page" to the container, which will process
all headings on the page wheresoever they may be.
*/
generated_toc = {
generate: function() {
// Identify our TOC element, and what it applies to
generate_from = '0';
generate_for = 'unset';
tocparent = document.getElementById('generated-toc');
if (tocparent) {
// there is a div class="generated-toc" in the document
// dictating where the TOC should appear
classes = tocparent.className.split(/\s+/);
for (var i=0; i<classes.length; i++) {
// if it specifies which heading level to generate from,
// or what level to generate for, save these specifications
if (classes[i].match(/^generate_from_h[1-6]$/)) {
generate_from = classes[i].substr(classes[i].length-1,1);
} else if (classes[i].match(/^generate_for_[a-z]+$/)) {
generate_for = classes[i].match(/^generate_for_([a-z])+$/)[1];
}
}
} else {
// They didn't specify a TOC element; exit
return;
}
// set top_node to be the element in the document under which
// we'll be analysing headings
if (generate_for == 'page') {
top_node = document.getElementsByTagName('body');
} else {
// i.e., explicitly set to "parent", left blank (so "unset"),
// or some invalid value
top_node = tocparent.parentNode;
}
// If there isn't a specified header level to generate from, work
// out what the first header level inside top_node is
// and make that the specified header level
if (generate_from == 0) {
first_header_found = generated_toc.findFirstHeader(top_node);
if (!first_header_found) {
// there were no headers at all inside top_node!
return;
} else {
generate_from = first_header_found.toLowerCase().substr(1);
}
}
// add all levels of heading we're paying attention to to the
// headings_to_treat dictionary, ready to be filled in later
headings_to_treat = {"h6":''};
for (var i=5; i>= parseInt(generate_from); i--) {
headings_to_treat["h" + i] = '';
}
// get headings. We can't say
// getElementsByTagName("h1" or "h2" or "h3"), etc, so get all
// elements and filter them ourselves
// need to use .all here because IE doesn't support gEBTN('*')
nodes = top_node.all ? top_node.all : top_node.getElementsByTagName('*');
// put all the headings we care about in headings
headings = [];
for (var i=0; i<nodes.length;i++) {
if (nodes[i].nodeName.toLowerCase() in headings_to_treat) {
// if heading has class no-TOC, skip it
if ((' ' + nodes[i].className + ' ').indexOf('no-TOC') != -1) {
continue;
}
headings.push(nodes[i]);
}
}
// make the basic elements of the TOC itself, ready to fill into
// first, check if there's a cookie defined to save the state as open
status = generated_toc.readCookie("generated_toc_display");
if (status && status == "open") {
display_initially = "block";
toggle_initially = "Hide table of contents";
} else {
display_initially = "none";
toggle_initially = "Show table of contents";
}
cur_head_lvl = "h" + generate_from;
cur_list_el = document.createElement('ul');
cur_list_el.style.display = display_initially;
p = document.createElement('p');
span = document.createElement('span');
span.className = 'hidden';
a = document.createElement('a');
a.href = '#aftertoc';
a.appendChild(document.createTextNode('skip table of contents'));
span.appendChild(a);
p.appendChild(span);
tocparent.appendChild(p);
p = document.createElement('p');
p.id = 'toggle-container';
a = document.createElement('a');
a.id = 'generated_toc_d_toggle';
a.appendChild(document.createTextNode(toggle_initially));
p.appendChild(a);
a.onclick = generated_toc.wrapOpenClose(a,cur_list_el);
a.href = '#';
tocparent.appendChild(p);
tocparent.appendChild(cur_list_el);
// now walk through our saved heading nodes
for (var i=0; i<headings.length; i++) {
this_head_el = headings[i];
this_head_lvl = headings[i].nodeName.toLowerCase();
if (!this_head_el.id) {
// if heading doesn't have an ID, give it one
this_head_el.id = 'heading_toc_j_' + i;
this_head_el.setAttribute('tabindex','-1');
}
while(this_head_lvl > cur_head_lvl) {
// this heading is at a lower level than the last one;
// create additional nested lists to put it at the right level
// get the *last* LI in the current list, and add our new UL to it
var last_listitem_el = null;
for (var j=0; j<cur_list_el.childNodes.length; j++) {
if (cur_list_el.childNodes[j].nodeName.toLowerCase() == 'li') {
last_listitem_el = cur_list_el.childNodes[j];
}
}
if (!last_listitem_el) {
// there aren't any LIs, so create a new one to add the UL to
last_listitem_el = document.createElement('li');
}
new_list_el = document.createElement('ul');
last_listitem_el.appendChild(new_list_el);
cur_list_el.appendChild(last_listitem_el);
cur_list_el = new_list_el;
cur_head_lvl = 'h' + (parseInt(cur_head_lvl.substr(1,1)) + 1);
}
while (this_head_lvl < cur_head_lvl) {
// this heading is at a higher level than the last one;
// go back up the TOC to put it at the right level
cur_list_el = cur_list_el.parentNode.parentNode;
cur_head_lvl = 'h' + (parseInt(cur_head_lvl.substr(1,1)) - 1);
}
// create a link to this heading, and add it to the TOC
li = document.createElement('li');
a = document.createElement('a');
a.href = '#' + this_head_el.id;
a.appendChild(document.createTextNode(generated_toc.innerText(this_head_el)));
li.appendChild(a);
cur_list_el.appendChild(li);
}
// add an aftertoc paragraph as destination for the skip-toc link
p = document.createElement('p');
p.id = 'aftertoc';
tocparent.appendChild(p);
// go through the TOC and find all LIs that are "empty", i.e., contain
// only ULs and no links, and give them class="missing"
var alllis = tocparent.getElementsByTagName("li");
for (var i=0; i<alllis.length; i++) {
var foundlink = false;
for (var j=0; j<alllis[i].childNodes.length; j++) {
if (alllis[i].childNodes[j].nodeName.toLowerCase() == 'a') {
foundlink = true;
}
}
if (!foundlink) {
alllis[i].className = "missing";
} else {
alllis[i].className = "notmissing";
}
}
},
wrapOpenClose: function(a, cur_list_el) {
// we return a function here so that it acts as a closure;
// in essence the inner function, which is the event handler
// for clicking on the toggle-toc link, remembers the a and cur_list_el
// elements as they are when they're passed in to it.
// This is an explicit function rather than an anonymous function
// defined where it's called so it's easier to understand.
return function(e) {
d = cur_list_el.style.display;
a.firstChild.nodeValue = (d == 'block' ? 'Show' : 'Hide') + ' table of contents';
a.className = (d == 'block' ? 'toggle-closed' : 'toggle-open');
cur_list_el.style.display = d == 'block' ? 'none' : 'block';
// set a cookie to "open" or "closed" to save the state of the TOC
if (cur_list_el.style.display == "block") {
generated_toc.createCookie("generated_toc_display","open",21);
} else {
generated_toc.createCookie("generated_toc_display","closed",21);
}
if (window.event) {
window.event.returnValue = false;
window.event.cancelBubble = true;
} else {
e.preventDefault();
e.stopPropagation();
}
}
},
/* cookie handling: http://www.quirksmode.org/js/cookies.html */
createCookie: function(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
},
readCookie: function(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length,c.length);
}
return null;
},
eraseCookie: function(name) {
createCookie(name,"",-1);
},
innerText: function(el) {
return (typeof(el.innerText) != 'undefined') ? el.innerText :
(typeof(el.textContent) != 'undefined') ? el.textContent :
el.innerHTML.replace(/<[^>]+>/g, '');
},
findFirstHeader: function(node) {
// a recursive function which returns the first header it finds inside
// node, or null if there are no functions inside node.
var nn = node.nodeName.toLowerCase();
if (nn.match(/^h[1-6]$/)) {
// this node is itself a header; return our name
return nn;
} else {
for (var i=0; i<node.childNodes.length; i++) {
var subvalue = generated_toc.findFirstHeader(node.childNodes[i]);
// if one of the subnodes finds a header, abort the loop and return it
if (subvalue) return subvalue;
}
// no headers in this node at all
return null;
}
},
init: function() {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
generated_toc.generate();
}
};
(function(i) {var u =navigator.userAgent;var e=/*@cc_on!@*/false; var st =
setTimeout;if(/webkit/i.test(u)){st(function(){var dr=document.readyState;
if(dr=="loaded"||dr=="complete"){i()}else{st(arguments.callee,10);}},10);}
else if((/mozilla/i.test(u)&&!/(compati)/.test(u)) || (/opera/i.test(u))){
document.addEventListener("DOMContentLoaded",i,false); } else if(e){ (
function(){var t=document.createElement('doc:rdy');try{t.doScroll('left');
i();t=null;}catch(e){st(arguments.callee,0);}})();}else{window.onload=i;}})(generated_toc.init);
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<div>
<div>
<div id="generated-toc"></div>
<h1>foo</h1>
<h2>bar</h2>
</div>
<h1>quux</h1>
</div>
-
JavaScript Add-Remove HTML Elements with DOM
This JavaScript code example will dynamically add/remove HTML elements with content included within them according to ... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Place JavaScript below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Dustin Diaz | http://www.dustindiaz.com/
// This script downloaded from www.JavaScriptBank.com
var Dom = {
get: function(el) {
if (typeof el === 'string') {
return document.getElementById(el);
} else {
return el;
}
},
add: function(el, dest) {
var el = this.get(el);
var dest = this.get(dest);
dest.appendChild(el);
},
remove: function(el) {
var el = this.get(el);
el.parentNode.removeChild(el);
}
};
var Event = {
add: function() {
if (window.addEventListener) {
return function(el, type, fn) {
Dom.get(el).addEventListener(type, fn, false);
};
} else if (window.attachEvent) {
return function(el, type, fn) {
var f = function() {
fn.call(Dom.get(el), window.event);
};
Dom.get(el).attachEvent('on' + type, f);
};
}
}()
};
Event.add(window, 'load', function() {
var i = 0;
Event.add('add-element', 'click', function() {
var el = document.createElement('p');
el.innerHTML = 'Remove This Element (' + ++i + ')';
Dom.add(el, 'content');
Event.add(el, 'click', function(e) {
Dom.remove(this);
});
});
});
</script>
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<div id="doc">
<p id="add-element">Add Elements</p>
<div id="content"></div>
</div>
-
JavaScript Filename Array Maker
During coding JavaScript applications, we usually have to work with many JavaScript arrays; and sometimes declare/initiate them is the time-consuming tasks.
For this reason, I would like to present... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Copy & Paste CSS code below in your HEAD section
CSS
Code:
<style type="text/css">
#display {
position: relative;
left: 10px;
width: 450px;
border: 1px solid black;
padding: 10px;
}
</style>
Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Mr. J | http://www.huntingground.net/
// This script downloaded from www.JavaScriptBank.com
function init(){
array_name=document.f1.t1.value //name of array
val2=document.f1.t3a.value
ext=document.f1.t4.value
for(r=0;r<document.f1.r1.length;r++){ // check which r1 radio is selected
if(document.f1.r1[r].checked==true){
option=document.f1.r1[r].value // selected radio value
}
}
if(option==0){
document.getElementById("display").innerHTML=array_name+" = new Array(" // opening array type 1
} else {
document.getElementById("display").innerHTML=array_name+" = new Array()<br>" // opening array type 2 & 3
}
if(document.f1.r2[0].checked==true){ // if indexed values
make_array1()
}
if(document.f1.r2[1].checked==true){ // if non index values
make_array2()
}
}
function make_array1(){
array_length=document.f1.t2.value-1 // length of array
index_values=document.f1.t3.value // index value
if(array_length==""||array_length==0){ // make sure a viable number is used
document.getElementById("display").innerHTML="Please Enter a Number"
document.f1.b2.disabled=true
return
} else {
if(!ns){document.f1.cpy.disabled=false}
}
for(num=0;num<array_length;num++){
j=num
if(num<10){num="00"+num}
if(num>9&&num<100){num="0"+num}
if(document.f1.t4.value.length>0){
i=num+val2+ext}
else{i=num+val2}
if(option==0){ // insert inner indexes for type 1
document.getElementById("display").innerHTML+="\""+index_values+i+"\", "
} else {
if(option==1){ // insert inner indexes for type 2
document.getElementById("display").innerHTML+=array_name+"["+j+"]="
document.getElementById("display").innerHTML+="\""+index_values+i+"\"<br>"
} else { // insert inner indexes for type 3
document.getElementById("display").innerHTML+=array_name+"["+array_name+".length]=\""+index_values+i+"\"<br>"
}
}
}
if(num<10){num="00"+num}
if(num>9&&num<100){num="0"+num}
if(num>100){num=num}
if(document.f1.t4.value.length>0){
i= num+val2+ext}
else{i=num+val2}
if(option==0){ // insert last indexes for type 1
document.getElementById("display").innerHTML+="\""+index_values+i+"\")"
} else {
if(option==1){ // insert last indexes for type 2
document.getElementById("display").innerHTML+=array_name+"["+(j+1)+"]="
document.getElementById("display").innerHTML+="\""+index_values+i+"\"<br>"
} else { // insert last indexes for type 3
document.getElementById("display").innerHTML+=array_name+"["+array_name+".length]=\""+index_values+i+"\"<br>"
}
}
}
index_value=new Array()
count= 0
last=0
function make_array2(){
if(!ns){document.f1.cpy.disabled=false}
for(r=0;r<document.f1.r1.length;r++){ // check which r1 radio is selected
if(document.f1.r1[r].checked==true){
chkrad=r
}
}
if(chkrad!=last){ // prevent additional index when only changing array style
count--
}
if(document.f1.t4.value.length>0){
index_value[count]=document.f1.t3.value+ext}
else {
index_value[count]=document.f1.t3.value
}
for(i=0;i<count;i++){
if(option==0){
document.getElementById("display").innerHTML+="\""+index_value[i]+"\", "
} else {
if(option==2){
document.getElementById("display").innerHTML+=array_name+"["+array_name+".length]=\""+index_value[i]+"\"<br>"
} else {
document.getElementById("display").innerHTML+=array_name+"["+i+"]=\""+index_value[i]+"\"<br>"
}
}
}
if(option==0){
document.getElementById("display").innerHTML+="\""+index_value[i]+"\")"
} else {
if(option==2){
document.getElementById("display").innerHTML+=array_name+"["+array_name+".length]=\""+index_value[i]+"\"<br>"
} else {
document.getElementById("display").innerHTML+=array_name+"["+i+"]=\""+index_value[i]+"\"<br>"
}
}
count++
document.f1.t3.select()
last=chkrad
}
function oreset(){
count=0
document.f1.t3.value=""
document.getElementById("display").innerHTML=""
document.f1.t3.select()
}
function chk(){
if(document.f1.r2[0].checked==true){
document.f1.t2.disabled=false
document.getElementById("sp").disabled=false
document.f1.t2.style.backgroundColor="#FFFFFF"
document.f1.b1.disabled=false
document.f1.b2.disabled=true
document.f1.b3.disabled=true
document.f1.t3a.disabled=false
document.f1.t3a.style.backgroundColor="#FFFFFF"
} else {
document.f1.t2.disabled=true
document.getElementById("sp").disabled=true
document.f1.t2.style.backgroundColor="#c0c0c0"
document.f1.b1.disabled=true
document.f1.b2.disabled=false
document.f1.b3.disabled=false
document.f1.t3.select()
document.f1.t3a.disabled=true
document.f1.t3a.style.backgroundColor="#c0c0c0"
}
}
function Copy(id){
if(ns){
alert("Sorry, Netscape does not recongise this function")
document.f1.cpy.disabled=true
return
}
copyit=id
textRange = document.body.createTextRange();
textRange.moveToElementText(copyit);
textRange.execCommand("Copy");
alert("Copying Complete.\n\nPlease Paste into your SCRIPT")
}
ns=document.getElementById&&!document.all
function getKey(e) {
pressed_key=(!ns)?event.keyCode:e.which
if( pressed_key==13){
init()
}
}
document.onkeypress = getKey;
</script>
Step 3: Copy & Paste HTML code below in your BODY section
HTML
Code:
<!--
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
-->
<form name="f1">
<table border="0">
<tr>
<td>Array Name:</td>
<td colspan="6">
<input type="text" name="t1" value="myArray">
</td>
</tr><tr>
<td>
<span id="sp">Indexed Array Length:</span>
</td>
<td colspan="6">
<input type="text" name="t2" value="5" size="3" maxlength="3">
</td>
</tr><tr>
<td>Index Value:</td>
<td colspan="6">
<input type="text" name="t3" value="image" size="10">
<input type="text" name="t3a" value="_tn" size="10"> Ext
<input type="text" name="t4" value=".jpg" size="4" maxlength="4">
</td>
</tr><tr>
<td>Index Style:</td>
<td align="right">1
<input type="radio" name="r1" value="0" checked onclick="init()">
</td>
<td> </td>
<td align="right">2
<input type="radio" name="r1" value="1" onclick="init()">
</td>
<td> </td>
<td align="right">3
<input type="radio" name="r1" value="2" onclick="init()">
</td>
<td width="80"> </td>
</tr><tr>
<td>Add Numerical Values:</td>
<td align="right">Yes
<input type="radio" name="r2" value="0" checked onclick="chk()">
</td>
<td align="center"> </td>
<td align="right">No
<input type="radio" name="r2" value="1" onclick="chk()">
</td>
<td> </td>
<td colspan="2"> </td>
</tr><tr align="center">
<td>
<input type="button" name="b1" value="Numerical Enter" onclick="init()">
</td>
<td colspan="6">
<input type="button" name="cpy" value="Copy Array" onclick="Copy(display)" disabled>
<input type="button" name="b2" value="Manual Enter" onclick="init()" disabled>
<input type="button" name="b3" value="Restart" onclick="oreset()" disabled>
</td>
</tr>
</table>
</form>
<div id="display"></div>
-
jQuery JavaScript Countdown Timer with Bar Display
This is really a cool JavaScript code example to display an amazing JavaScript countdown timer on your web pages. With the support of the powerful JavaScript framework - jQuery - you can set the point... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css" media="screen">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
#seconds-box,#minutes-box,#hours-box,#days-box {
width: 222px;
height: 30px;
background: #eee;
border: 1px solid #ccc;
}
#seconds-outer,#minutes-outer,#hours-outer,#days-outer {
margin: 10px;
width: 200px;
height: 9px;
border: 1px solid #aaa;
background: #f3f3f3;
}
#seconds-inner,#minutes-inner,#hours-inner,#days-inner {
height: 100%;
width: 100%;
background: #c00;
}
#seconds-count,#minutes-count,#hours-count,#days-count {
float: left;
font-size: 0.9em;
margin-left: -200px;
margin-top: 7px;
}
</style>
Step 2: Place JavaScript below in your HEAD section
JavaScript
Code:
<script type="text/javascript" src="/javascript/jquery.js"></script>
<script type="text/javascript">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
function timeleft(timetype){
days=0;hours=0;mins=0;
var e = new Date(2010,11,25,0,0,0);
var now = new Date();
var left = e.getTime() - now.getTime();
left = Math.floor(left/1000);
days = Math.floor(left/86400);
left = left%86400;
hours=Math.floor(left/3600);
left=left%3600;
mins=Math.floor(left/60);
left=left%60;
secs=Math.floor(left);
switch(timetype){
case "s":
return secs;
break;
case "m":
return mins;
break;
case "h":
return hours;
break;
case "d":
return days;
break;
}
}
function set_start_count(){
set_hour_count();
set_minute_count();
set_day_count();
}
function set_day_count(){
d=timeleft('d');
$('#days-count').text(d.toString() + ' day(s)');
}
function set_hour_count(){
h=timeleft('h');
$('#hours-count').text(h.toString() + ' hour(s)');
}
function set_minute_count(){
m = timeleft('m');
$('#minutes-count').text(m.toString()+ ' minute(s)');
}
function set_second_count(){
s = timeleft('s');
$('#seconds-count').text(s.toString() + ' second(s)');
}
function update_minute(){
var now = new Date();
var mw = $('#minutes-outer').css('width');
mw = mw.slice(0,-2);
var s = now.getSeconds();
sleft = (60 - s)
if (sleft == 0)
{
sleft=60;
}
m = ((sleft/60)*mw).toFixed();
$('#minutes-inner').css({width:m});
return sleft*1000;
}
function update_hour(){
var now = new Date();
var mw = $('#hours-outer').css('width');
mw = mw.slice(0,-2);
var s = now.getMinutes();
sleft = 60 - s
m = ((sleft/60)*mw).toFixed();
$('#hours-inner').css({width: m});
return sleft*(1000*60);
}
function update_day(){
var now = new Date();
var mw = $('#days-outer').css('width');
mw = mw.slice(0,-2);
var s = now.getHours();
sleft = 24 - s
m = ((sleft/24)*mw).toFixed();
$('#days-inner').css({width: m });
return sleft*(1000*60*24);
}
function reset_day(){
$('#days-inner').width($('#days-outer').width());
start_countdown_day();
}
function reset_hour(){
$('#hours-inner').width($('#hours-outer').width());
start_countdown_hour();
}
function reset_second(){
$('#seconds-inner').width($('#seconds-outer').width());
start_countdown_second();
}
function reset_minute(){
$('#minutes-inner').width($('#minutes-outer').width());
start_countdown_minute();
}
function start_countdown_second(){
set_second_count();
now = new Date();
$('#seconds-inner').animate({width: 0}, 1000,reset_second);
}
function start_countdown_minute(){
set_minute_count();
$('#minutes-inner').animate({width: 0}, update_minute(),reset_minute);
//update_minute());
}
function start_countdown_hour(){
set_hour_count();
$('#hours-inner').animate({width: 0},update_hour(),reset_hour);
}
function start_countdown_day(){
set_day_count();
$('#days-inner').animate({width: 0},update_day(),reset_day);
}
$(document).ready( function(){
start_countdown_second();
start_countdown_minute();
start_countdown_hour();
start_countdown_day();
});
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<center>
<div id="days-box">
<div id="days-count"> </div>
<div id="days-outer">
<div id="days-inner"> </div>
</div>
</div>
<div id="hours-box">
<div id="hours-count"> </div>
<div id="hours-outer">
<div id="hours-inner"> </div>
</div>
</div>
<div id="minutes-box">
<div id="minutes-count"> </div>
<div id="minutes-outer">
<div id="minutes-inner"> </div>
</div>
</div>
<div id="seconds-box">
<div id="seconds-count"> </div>
<div id="seconds-outer">
<div id="seconds-inner"> </div>
</div>
</div>
</center>
Step 4: must download files below
Files
jquery.js
-
JavaScript Dynamic Drop Down Values on Action
If your web pages have a huge list of options to show in the drop down menus (listed into categories), why don't you consider to use this JavaScri... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Sandeep Gangadharan | http://www.sivamdesign.com/scripts/
// This script downloaded from www.JavaScriptBank.com
function changer(link) {
if (link=="") {
return; }
//======================
// Edit this portion below. For each new state copy and paste
// the entire IF statement and change the name of the state and the cities.
// Make sure the spelling of the state is the same in the IF statement and in the link.
if (link=="Arizona") {
document.theForm.theState.value="Arizona";
var theOptions=new Array (
"Bisbee",
"Deer Valley",
"Flagstaff",
"Mesa",
"Phoenix"); }
else if (link=="California") {
document.theForm.theState.value="California";
var theOptions=new Array (
"Alameda",
"Bakersfield",
"Burbank",
"Los Angeles"); }
else if (link=="Florida") {
document.theForm.theState.value="Florida";
var theOptions=new Array (
"Altamonte Springs",
"Boca Raton",
"Miami",
"West Palm Beach"); }
else if (link=="New York") {
document.theForm.theState.value="New York";
var theOptions=new Array (
"Albany",
"East Rockaway",
"New York City"); }
// Do not edit anything below this line:
//======================
i = document.theForm.secondChoice.options.length;
if (i > 0) {
document.theForm.secondChoice.options.length -= i; document.theForm.secondChoice.options[i] = null;
}
var theCount=0;
for (e=0; e<theOptions.length; e++) {
document.theForm.secondChoice.options[theCount] = new Option();
document.theForm.secondChoice.options[theCount].text = theOptions[e];
document.theForm.secondChoice.options[theCount].value = theOptions[e];
theCount=theCount+1; }
}
// NOTE: [document.theForm.theState.value] will get you the name of the state,
// and [document.theForm.secondChoice.value] the name of the city chosen
</script>
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<!--
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/
-->
<form name=theForm>
<strong>Select a State:</strong><br>
<a href="javascript:changer('Arizona')">Arizona</a> |
<a href="javascript:changer('California')">California</a> |
<a href="javascript:changer('Florida')">Florida</a> |
<a href="javascript:changer('New York')">New York</a>
<br><br>
<strong>Then ...</strong><br>
<input type="hidden" name="theState">
<select name="secondChoice">
<option value="">Select a City</option>
</select>
</form>
-
Build Simple Flash Timer Countdown in ActionScript
Countdown timer for an event seems to be an indispensable thing in the modern life of human, we can see them in the holidays of Christmas, new year, birthday, etc. Or easily, we can see them daily in ... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
-
Simple JavaScript for Auto-Sum with Checkboxes
This JavaScript code example uses a for loop to calculate the sum of JavaScript checkbox values. This JavaScript will display a running total automatically wh... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: Place JavaScript below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: Jay Rumsey | http://www.nova.edu/~rumsey/
// This script downloaded from JavaScriptBank.com
function UpdateCost() {
var sum = 0;
var gn, elem;
for (i=0; i<5; i++) {
gn = 'game'+i;
elem = document.getElementById(gn);
if (elem.checked == true) { sum += Number(elem.value); }
}
document.getElementById('totalcost').value = sum.toFixed(2);
}
</script>
Step 2: Place HTML below in your BODY section
HTML
Code:
<input type="checkbox" id='game0' value="9.99" onclick="UpdateCost()">Game 1 ( 9.99)<br>
<input type="checkbox" id='game1' value="19.99" onclick="UpdateCost()">Game 2 (19.99)<br>
<input type="checkbox" id='game2' value="27.50" onclick="UpdateCost()">Game 3 (27.50)<br>
<input type="checkbox" id='game3' value="45.65" onclick="UpdateCost()">Game 4 (45.65)<br>
<input type="checkbox" id='game4' value="87.20" onclick="UpdateCost()">Game 5 (87.20)<br>
-
JavaScript Virtual Keyboard Interface with Many Languages
This JavaScript code example is a cool reusable script to add a graphical virtual keyboard interface to text fields, password fields, and textareas so they can be filled with mouse only for better sec... detail at JavaScriptBank.com - 2.000+ free JavaScript codes
How to setup
Step 1: CSS below for styling thescript, place it into HEAD section
CSS
Code:
<style type="text/css">
#keyboardInputMaster {
position:absolute;
border:2px groove #dddddd;
color:#000000;
background-color:#dddddd;
text-align:left;
z-index:1000000;
width:auto;
}
#keyboardInputMaster thead tr th {
text-align:left;
padding:2px 5px 2px 4px;
background-color:inherit;
border:0px none;
}
#keyboardInputMaster thead tr th select,
#keyboardInputMaster thead tr th label {
color:#000000;
font:normal 11px Arial,sans-serif;
}
#keyboardInputMaster thead tr td {
text-align:right;
padding:2px 4px 2px 5px;
background-color:inherit;
border:0px none;
}
#keyboardInputMaster thead tr td span {
padding:1px 4px;
font:bold 11px Arial,sans-serif;
border:1px outset #aaaaaa;
background-color:#cccccc;
cursor:pointer;
}
#keyboardInputMaster thead tr td span.pressed {
border:1px inset #999999;
background-color:#bbbbbb;
}
#keyboardInputMaster tbody tr td {
text-align:left;
margin:0px;
padding:0px 4px 3px 4px;
}
#keyboardInputMaster tbody tr td div {
text-align:center;
position:relative;
height:0px;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout {
height:auto;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table {
height:20px;
white-space:nowrap;
width:100%;
border-collapse:separate;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table.keyboardInputCenter {
width:auto;
margin:0px auto;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td {
vertical-align:middle;
padding:0px 5px 0px 5px;
white-space:pre;
font:normal 11px 'Lucida Console',monospace;
border-top:1px solid #e5e5e5;
border-right:1px solid #5d5d5d;
border-bottom:1px solid #5d5d5d;
border-left:1px solid #e5e5e5;
background-color:#eeeeee;
cursor:default;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.last {
width:99%;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.alive {
background-color:#ccccdd;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.target {
background-color:#ddddcc;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.hover {
border-top:1px solid #d5d5d5;
border-right:1px solid #555555;
border-bottom:1px solid #555555;
border-left:1px solid #d5d5d5;
background-color:#cccccc;
}
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.pressed,
#keyboardInputMaster tbody tr td div#keyboardInputLayout table tbody tr td.dead {
border-top:1px solid #555555;
border-right:1px solid #d5d5d5;
border-bottom:1px solid #d5d5d5;
border-left:1px solid #555555;
background-color:#cccccc;
}
#keyboardInputMaster tbody tr td div var {
position:absolute;
bottom:0px;
right:0px;
font:bold italic 11px Arial,sans-serif;
color:#444444;
}
.keyboardInputInitiator {
margin-left:3px;
vertical-align:middle;
cursor:pointer;
}
</style>
Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script type="text/javascript">
// Created by: GreyWyvern | http://www.greywyvern.com
// Licensed under: BSDL: http://www.opensource.org/licenses/bsd-license.php
// This script downloaded from www.JavaScriptBank.com
/* ********************************************************************
**********************************************************************
* HTML Virtual Keyboard Interface Script - v1.10
* Copyright (c) 2008 - GreyWyvern
*
* - Licenced for free distribution under the BSDL
* http://www.opensource.org/licenses/bsd-license.php
*
* Add a script-driven keyboard interface to text fields, password
* fields and textareas.
*
* See http://www.greywyvern.com/code/js/keyboard.html for examples and
* usage instructions.
*
* Version 1.10 - April 14, 2008
* - Slovenian keyboard layout added by Miran Zeljko
*
* Version 1.9 - April 3, 2008
* - Hungarian keyboard layout added by Antal Sall 'Hiromacu'
*
* Version 1.8 - March 31, 2008
* - Performance tweaks
*
* Version 1.7 - March 27, 2008
* - Arabic keyboard layout added by Srinivas Reddy
*
* Version 1.6 - January 16, 2008
* - Hebrew keyboard layout added by Enon Avital
*
* Version 1.5 - January 7, 2008
* - Italian and Spanish (Spain) keyboard layouts added by dictionarist.com
*
* Version 1.4a - October 15, 2007
* - Keyboard is fully removed from document when hidden
*
* Version 1.4 - August 1, 2007
* - Simplified layout syntax a bit
* - Added version number to lower right of interface
* - Various other small bug fixes
*
* Version 1.3 - July 30, 2007
* - Interaction styling changes (Alt, AltGr, Shift)
* - Justified keys - last key expands to fit width
* - If no dead keys in layout, dead key checkbox is hidden
* - Option to disable dead keys per keyboard
* - Added the Number Pad layout
* - Pulled all variations of script up to same version number
*
* Keyboard Credits
* - Slovenian keyboard layout added by Miran Zeljko
* - Hungarian keyboard layout added by Antal Sall 'Hiromacu'
* - Arabic keyboard layout added by Srinivas Reddy
* - Italian and Spanish (Spain) keyboard layouts added by dictionarist.com
* - Lithuanian and Russian keyboard layouts added by Ramunas
* - German keyboard layout added by QuHno
* - French keyboard layout added by Hidden Evil
* - Polish Programmers layout assisted by moose
* - Turkish keyboard layouts added by offcu
* - Dutch and US Int'l keyboard layouts assisted by jerone
* - Portuguese keyboard layout added by clisboa
*
*/
function VKI_buildKeyboardInputs() {
var self = this;
this.VKI_version = "1.10";
this.VKI_target = this.VKI_visible = "";
this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
this.VKI_deadkeysOn = false;
this.VKI_kt = "US"; // Default keyboard layout
this.VKI_range = false;
this.VKI_keyCenter = 3;
/* ***** Create keyboards **************************************** */
this.VKI_layout = new Object();
this.VKI_layoutDDK = new Object();
// - Lay out each keyboard in rows of sub-arrays. Each sub-array
// represents one key.
//
// - Each sub-array consists of four slots described as follows:
// example: ["a", "A", "\u00e1", "\u00c1"]
//
// a) Normal character
// A) Character + Shift or Caps
// \u00e1) Character + Alt or AltGr
// \u00c1) Character + Shift or Caps + Alt or AltGr
//
// You may include sub-arrays which are fewer than four slots. In
// these cases, the missing slots will be blanked when the
// corresponding modifier key (Shift or AltGr) is pressed.
//
// - If the second slot of a sub-array matches one of the following
// strings:
// "Tab", "Caps", "Shift", "Enter", "Bksp", "Alt" OR "AltGr"
// then the function of the key will be the following,
// respectively:
// - Insert a tab
// - Toggle Caps Lock (technically a Shift Lock)
// - Next entered character will be the shifted character
// - Insert a newline (textarea), or close the keyboard
// - Delete the previous character
// - Next entered character will be the alternate character
//
// The first slot of this sub-array will be the text to display on
// the corresponding key. This allows for easy localisation of key
// names.
//
// - Layout dead keys (diacritic + letter) should be added as arrays
// of two item arrays with hash keys equal to the diacritic. See
// the "this.VKI_deadkey" object below the layout definitions. In
// each two item child array, the second item is what the diacritic
// would change the first item to.
//
// - To disable dead keys for a layout, simply assign true to the
// this.VKI_layoutDDK (DDK = disable dead keys) object of the same
// name as the layout. See the Numpad layout below for an example.
//
// - Note that any characters beyond the normal ASCII set should be
// entered in escaped Unicode format. (eg \u00a3 = Pound symbol)
// You can find Unicode values for characters here:
// http://unicode.org/charts/
//
// - To remove a keyboard, just delete it, or comment it out of the
// source code
this.VKI_layout.Arabic = [ // Arabic Keyboard
[["\u0630", "\u0651 "], ["1", "!", "\u00a1", "\u00b9"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a4", "\u00a3"], ["5", "%", "\u20ac"], ["6", "^", "\u00bc"], ["7", "&", "\u00bd"], ["8", "*", "\u00be"], ["9", "(", "\u2018"], ["0", ")", "\u2019"], ["-", "_", "\u00a5"], ["=", "+", "\u00d7", "\u00f7"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["\u0636", "\u064e"], ["\u0635", "\u064b"], ["\u062b", "\u064f"], ["\u0642", "\u064c"], ["\u0641", "\u0644"], ["\u063a", "\u0625"], ["\u0639", "\u2018"], ["\u0647", "\u00f7"], ["\u062e", "\u00d7"], ["\u062d", "\u061b"], ["\u062c", "\u003c"], ["\u062f", "\u003e"], ["\u005c", "\u007c"]],
[["Caps", "Caps"], ["\u0634", "\u0650"], ["\u0633", "\u064d"], ["\u064a", "\u005d"], ["\u0628", "\u005b"], ["\u0644", "\u0644"], ["\u0627", "\u0623"], ["\u062a", "\u0640"], ["\u0646", "\u060c"], ["\u0645", "\u002f"], ["\u0643", "\u003a"], ["\u0637", "\u0022"], ["Enter", "Enter"]],
[["Shift", "Shift"], ["\u0626", "\u007e"], ["\u0621", "\u0652"], ["\u0624", "\u007d"], ["\u0631", "\u007b"], ["\u0644", "\u0644"], ["\u0649", "\u0622"], ["\u0629", "\u2019"], ["\u0648", "\u002c"], ["\u0632", "\u002e"], ["\u0638", "\u061f"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["Alt", "Alt"]]
];
this.VKI_layout.Belgian = [ // Belgian Standard Keyboard
[["\u00b2", "\u00b3"], ["&", "1", "|"], ["\u00e9", "2", "@"], ['"', "3", "#"], ["'", "4"], ["(", "5"], ["\u00a7", "6", "^"], ["\u00e8", "7"], ["!", "8"], ["\u00e7", "9", "{"], ["\u00e0", "0", "}"], [")", "\u00b0"], ["-", "_"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u005e", "\u00a8", "["], ["$", "*", "]"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["\u00f9", "%", "\u00b4"], ["\u03bc", "\u00a3", "`"]],
[["Shift", "Shift"], ["<", ">", "\\"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["=", "+", "~"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Dutch = [ // Dutch Standard Keyboard
[["@", "\u00a7", "\u00ac"], ["1", "!", "\u00b9"], ["2", '"', "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00bc"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "_", "\u00a3"], ["8", "(", "{"], ["9", ")", "}"], ["0", "'"], ["/", "?", "\\"], ["\u00b0", "~", "\u00b8"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R", "\u00b6"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00a8", "^"], ["*", "|"], ["<", ">"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S", "\u00df"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["+", "\u00b1"], ["\u00b4", "\u0060"], ["Enter", "Enter"]],
[["Shift", "Shift"], ["]", "[", "\u00a6"], ["z", "Z", "\u00ab"], ["x", "X", "\u00bb"], ["c", "C", "\u00a2"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":", "\u00b7"], ["-", "="], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Dvorak = [ // Dvorak Keyboard
[["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["[", "{"], ["]", "}"], ["Bksp", "Bksp"]],
[["Tab", "Tab"],["'", '"'], [",", "<"], [".", ">"], ["p", "P"], ["y", "Y"], ["f", "F"], ["g", "G"], ["c", "C"], ["r", "R"], ["l", "L"], ["/", "?"], ["=", "+"], ["\\", "|"]],
[["Caps", "Caps"], ["a", "A"], ["o", "O"], ["e", "E"], ["u", "U"], ["i", "I"], ["d", "D"], ["h", "H"], ["t", "T"], ["n", "N"], ["s", "S"], ["-", "_"], ["Enter", "Enter"]],
[["Shift", "Shift"], [";", ":"], ["q", "Q"], ["j", "J"], ["k", "K"], ["x", "X"], ["b", "B"], ["m", "M"], ["w", "W"], ["v", "V"], ["z", "Z"], ["Shift", "Shift"]],
[[" ", " "]]
];
this.VKI_layout.French = [ // French Standard Keyboard
[["\u00b2", "\u00b3"], ["&", "1"], ["\u00e9", "2", "~"], ['"', "3", "#"], ["'", "4", "{"], ["(", "5", "["], ["-", "6", "|"], ["\u00e8", "7", "\u0060"], ["_", "8", "\\"], ["\u00e7", "9", "\u005e"], ["\u00e0", "0", "\u0040"], [")", "\u00b0", "]"], ["=", "+", "}"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["a", "A"], ["z", "Z"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["^", "\u00a8"], ["$", "\u00a3", "\u00a4"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["q", "Q"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["m", "M"], ["\u00f9", "%"], ["*", "\u03bc"]],
[["Shift", "Shift"], ["<", ">"], ["w", "W"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], [",", "?"], [";", "."], [":", "/"], ["!", "\u00a7"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.German = [ // German Standard Keyboard
[["\u005e", "\u00b0"], ["1", "!"], ["2", '"', "\u00b2"], ["3", "\u00a7", "\u00b3"], ["4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["\u00df", "?", "\\"], ["\u00b4", "\u0060"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q", "\u0040"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00fc", "\u00dc"], ["+", "*", "~"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f6", "\u00d6"], ["\u00e4", "\u00c4"], ["#", "'"]],
[["Shift", "Shift"], ["<", ">", "\u00a6"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u00b5"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Greek = [ // Greek Standard Keyboard
[["`", "~"], ["1", "!"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a3"], ["5", "%", "\u00a7"], ["6", "^", "\u00b6"], ["7", "&"], ["8", "*", "\u00a4"], ["9", "(", "\u00a6"], ["0", ")", "\u00ba"], ["-", "_", "\u00b1"], ["=", "+", "\u00bd"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], [";", ":"], ["\u03c2", "^"], ["\u03b5", "\u0395"], ["\u03c1", "\u03a1"], ["\u03c4", "\u03a4"], ["\u03c5", "\u03a5"], ["\u03b8", "\u0398"], ["\u03b9", "\u0399"], ["\u03bf", "\u039f"], ["\u03c0", "\u03a0"], ["[", "{", "\u201c"], ["]", "}", "\u201d"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["\u03b1", "\u0391"], ["\u03c3", "\u03a3"], ["\u03b4", "\u0394"], ["\u03c6", "\u03a6"], ["\u03b3", "\u0393"], ["\u03b7", "\u0397"], ["\u03be", "\u039e"], ["\u03ba", "\u039a"], ["\u03bb", "\u039b"], ["\u0384", "\u00a8", "\u0385"], ["'", '"'], ["\\", "|", "\u00ac"]],
[["Shift", "Shift"], ["<", ">"], ["\u03b6", "\u0396"], ["\u03c7", "\u03a7"], ["\u03c8", "\u03a8"], ["\u03c9", "\u03a9"], ["\u03b2", "\u0392"], ["\u03bd", "\u039d"], ["\u03bc", "\u039c"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Hebrew = [ // Hebrew Standard Keyboard
[["~", "`"], ["1", "!"], ["2", "@"], ["3", "#"], ["4" , "$", "\u20aa"], ["5" , "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", ")"], ["0", "("], ["-", "_"], ["=", "+"], ["\\", "|"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["/", "Q"], ["'", "W"], ["\u05e7", "E", "\u20ac"], ["\u05e8", "R"], ["\u05d0", "T"], ["\u05d8", "Y"], ["\u05d5", "U", "\u05f0"], ["\u05df", "I"], ["\u05dd", "O"], ["\u05e4", "P"], ["]", "}"], ["[", "{"]],
[["Caps", "Caps"], ["\u05e9", "A"], ["\u05d3", "S"], ["\u05d2", "D"], ["\u05db", "F"], ["\u05e2", "G"], ["\u05d9", "H", "\u05f2"], ["\u05d7", "J", "\u05f1"], ["\u05dc", "K"], ["\u05da", "L"], ["\u05e3", ":"], ["," , '"'], ["Enter", "Enter"]],
[["Shift", "Shift"], ["\u05d6", "Z"], ["\u05e1", "X"], ["\u05d1", "C"], ["\u05d4", "V"], ["\u05e0", "B"], ["\u05de", "N"], ["\u05e6", "M"], ["\u05ea", ">"], ["\u05e5", "<"], [".", "?"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Hungarian = [ // Hungarian Standard Keyboard
[["0", "\u00a7"], ["1", "'", "\u007e"], ["2", '"', "\u02c7"], ["3", "+", "\u02c6"], ["4", "!", "\u02d8"], ["5", "%", "\u00b0"], ["6", "/", "\u02db"], ["7", "=", "\u0060"], ["8", "(", "\u02d9"], ["9", ")", "\u00b4"], ["\u00f6", "\u00d6", "\u02dd"], ["\u00fc", "\u00dc", "\u00a8"], ["\u00f3", "\u00d3", "\u00b8"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q", "\u005c"], ["w", "W", "\u007c"], ["e", "E", "\u00c4"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U", "\u20ac"], ["i", "I", "\u00cd"], ["o", "O"], ["p", "P"], ["\u0151", "\u0150", "\u00f7"], ["\u00fa", "\u00da", "\u00d7"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A", "\u00e4"], ["s", "S","\u0111"], ["d", "D","\u0110"], ["f", "F","\u005b"], ["g", "G","\u005d"], ["h", "H"], ["j", "J","\u00ed"], ["k", "K","\u0141"], ["l", "L","\u0142"], ["\u00e9", "\u00c9","\u0024"], ["\u00e1", "\u00c1","\u00df"], ["\u0171", "\u0170","\u00a4"]],
[["Shift", "Shift"], ["\u00ed", "\u00cd","\u003c"], ["y", "Y","\u003e"], ["x", "X","\u0023"], ["c", "C","\u0026"], ["v", "V","\u0040"], ["b", "B","\u007b"], ["n", "N","\u007d"], ["m", "M","\u003c"], [",", "?","\u003b"], [".", ":","\u003e"], ["-", "_","\u002a"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Italian = [ // Italian Standard Keyboard
[["\u005c", "\u007c"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "&"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00ec", "\u005e"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00e8", "\u00e9", "[", "{"], ["+", "*", "]", "}"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f2", "\u00e7", "@"], ["\u00e0", "\u00b0", "#"], ["\u00f9", "\u00a7"]],
[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Lithuanian = [ // Lithuanian Standard Keyboard
[["`", "~"], ["\u0105", "\u0104"], ["\u010D", "\u010C"], ["\u0119", "\u0118"], ["\u0117", "\u0116"], ["\u012F", "\u012E"], ["\u0161", "\u0160"], ["\u0173", "\u0172"], ["\u016B", "\u016A"], ["\u201E", "("], ["\u201C", ")"], ["-", "_"], ["\u017E", "\u017D"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", '"'], ["\\", "|"]],
[["Shift", "Shift"], ["\u2013", "\u20AC"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " "]]
];
this.VKI_layout.Norwegian = [ // Norwegian Standard Keyboard
[["|", "\u00a7"], ["1", "!"], ["2", '"', "@"], ["3", "#", "\u00a3"], ["4", "\u00a4", "$"], ["5", "%"], ["6", "&"], ["7", "/", "{"], ["8", "(", "["], ["9", ")", "]"], ["0", "=", "}"], ["+", "?"], ["\\", "`", "\u00b4"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u00e5", "\u00c5"], ["\u00a8", "^", "~"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f8", "\u00d8"], ["\u00e6", "\u00c6"], ["'", "*"]],
[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M", "\u03bc", "\u039c"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Numpad = [ // Number pad
[["$"], ["\u00a3"], ["\u20ac"], ["\u00a5"], ["/"], ["^"], ["Bksp", "Bksp"]],
[["."], ["7"], ["8"], ["9"], ["*"], ["<"], ["("], ["["]],
[["="], ["4"], ["5"], ["6"], ["-"], [">"], [")"], ["]"]],
[["0"], ["1"], ["2"], ["3"], ["+"], ["Enter", "Enter"]],
[[" "]]
];
this.VKI_layoutDDK.Numpad = true;
this.VKI_layout["Polish Prog"] = [ // Polish Programmers Keyboard
[["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u0119", "\u0118"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["\\", "|"]],
[["Caps", "Caps"], ["a", "A", "\u0105", "\u0104"], ["s", "S", "\u015b", "\u015a"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "\u0142", "\u0141"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
[["Shift", "Shift"], ["z", "Z", "\u017c", "\u017b"], ["x", "X", "\u017a", "\u0179"], ["c", "C", "\u0107", "\u0106"], ["v", "V"], ["b", "B"], ["n", "N", "\u0144", "\u0143"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["Alt", "Alt"]]
];
this.VKI_layout.Portuguese = [ // Portuguese Standard Keyboard
[["`", "\u00ac", "\u00a6"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00e7", "\u00c7"], [";", ":"], ["'", "@"], ["#", "~"]],
[["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.Russian = [ // Russian Standard Keyboard
[["\u0451", "\u0401"], ["1", "!"], ["2", '"'], ["3", "\u2116"], ["4", ";"], ["5", "%"], ["6", ":"], ["7", "?"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["\u0439", "\u0419"], ["\u0446", "\u0426"], ["\u0443", "\u0423"], ["\u043A", "\u041A"], ["\u0435", "\u0415"], ["\u043D", "\u041D"], ["\u0433", "\u0413"], ["\u0448", "\u0428"], ["\u0449", "\u0429"], ["\u0437", "\u0417"], ["\u0445", "\u0425"], ["\u044A", "\u042A"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["\u0444", "\u0424"], ["\u044B", "\u042B"], ["\u0432", "\u0412"], ["\u0430", "\u0410"], ["\u043F", "\u041F"], ["\u0440", "\u0420"], ["\u043E", "\u041E"], ["\u043B", "\u041B"], ["\u0434", "\u0414"], ["\u0436", "\u0416"], ["\u044D", "\u042D"], ["\\", "/"]],
[["Shift", "Shift"], ["/", "|"], ["\u044F", "\u042F"], ["\u0447", "\u0427"], ["\u0441", "\u0421"], ["\u043C", "\u041C"], ["\u0438", "\u0418"], ["\u0442", "\u0422"], ["\u044C", "\u042C"], ["\u0431", "\u0411"], ["\u044E", "\u042E"], [".", ","], ["Shift", "Shift"]],
[[" ", " "]]
];
this.VKI_layout.Slovenian = [ // Slovenian Standard Keyboard
[["\u00a8", "\u00a8", "\u00b8"], ["1", "!", "~"], ["2", '"', "\u02c7"], ["3", "#", "^"], ["4", "$", "\u02d8"], ["5", "%", "\u00b0"], ["6", "&", "\u02db"], ["7", "/", "\u0060"], ["8", "(", "\u00B7"], ["9", ")", "\u00b4"], ["0", "=", "\u2033"], ["'", "?", "\u00a8"], ["+", "*", "\u00b8"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q", "\\"], ["w", "W","|"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["z", "Z"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u0161", "\u0160", "\u00f7"], ["\u0111", "\u0110", "\u00d7"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F", "["], ["g", "G", "]"], ["h", "H"], ["j", "J"], ["k", "K", "\u0142"], ["l", "L", "\u0141"], ["\u010D", "\u010C"], ["\u0107", "\u0106", "\u00df"], ["\u017E", "\u017D", "\u00a4"]],
[["Shift", "Shift"], ["<", ">"], ["y", "Y"], ["x", "X"], ["c", "C"], ["v", "V", "@"], ["b", "B", "{",], ["n", "N", "}"], ["m", "M", "\u00a7"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout["Spanish-SP"] = [ // Spanish (Spain) Standard Keyboard
[["\u00ba", "\u00aa", "\\"], ["1", "!", "|"], ["2", '"', "@"], ["3", "'", "#"], ["4", "$", "~"], ["5", "%", "\u20ac"], ["6", "&","\u00ac"], ["7", "/"], ["8", "("], ["9", ")"], ["0", "="], ["'", "?"], ["\u00a1", "\u00bf"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["\u0060", "^", "["], ["\u002b", "\u002a", "]"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u00f1", "\u00d1"], ["\u00b4", "\u00a8", "{"], ["\u00e7", "\u00c7", "}"]],
[["Shift", "Shift"], ["<", ">"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", ";"], [".", ":"], ["-", "_"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout["Turkish-F"] = [ // Turkish F Keyboard Layout
[['+', "*", "\u00ac"], ["1", "!", "\u00b9", "\u00a1"], ["2", '"', "\u00b2"], ["3", "^", "#", "\u00b3"], ["4", "$", "\u00bc", "\u00a4"], ["5", "%", "\u00bd"], ["6", "&", "\u00be"], ["7", "'", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["/", "?", "\\", "\u00bf"], ["-", "_", "|"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["f", "F", "@"], ["g", "G"], ["\u011f", "\u011e"], ["\u0131", "\u0049", "\u00b6", "\u00ae"], ["o", "O"], ["d", "D", "\u00a5"], ["r", "R"], ["n", "N"], ["h", "H", "\u00f8", "\u00d8"], ["p", "P", "\u00a3"], ["q", "Q", "\u00a8"], ["w", "W", "~"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["u", "U", "\u00e6", "\u00c6"], ["i", "\u0130", "\u00df", "\u00a7"], ["e", "E", "\u20ac"], ["a", "A", " ", "\u00aa"], ["\u00fc", "\u00dc"], ["t", "T"], ["k", "K"], ["m", "M"], ["l", "L"], ["y", "Y", "\u00b4"], ["\u015f", "\u015e"], ["x", "X", "`"]],
[["Shift", "Shift"], ["<", ">", "|", "\u00a6"], ["j", "J", "\u00ab", "<"], ["\u00f6", "\u00d6", "\u00bb", ">"], ["v", "V", "\u00a2", "\u00a9"], ["c", "C"], ["\u00e7", "\u00c7"], ["z", "Z"], ["s", "S", "\u00b5", "\u00ba"], ["b", "B", "\u00d7"], [".", ":", "\u00f7"], [",", ";", "-"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout["Turkish-Q"] = [ // Turkish Q Keyboard Layout
[['"', "\u00e9", "<"], ["1", "!", ">"], ["2", "'", "\u00a3"], ["3", "^", "#"], ["4", "+", "$"], ["5", "%", "\u00bd"], ["6", "&"], ["7", "/", "{"], ["8", "(", '['], ["9", ")", ']'], ["0", "=", "}"], ["*", "?", "\\"], ["-", "_", "|"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q", "@"], ["w", "W"], ["e", "E", "\u20ac"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["\u0131", "\u0049", "\u0069", "\u0130"], ["o", "O"], ["p", "P"], ["\u011f", "\u011e", "\u00a8"], ["\u00fc", "\u00dc", "~"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A", "\u00e6", "\u00c6"], ["s", "S", "\u00df"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], ["\u015f", "\u015e", "\u00b4"], ["\u0069", "\u0130"], [",", ";", "`"]],
[["Shift", "Shift"], ["<", ">", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], ["\u00f6", "\u00d6"], ["\u00e7", "\u00c7"], [".", ":"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.UK = [ // UK Standard Keyboard
[["`", "\u00ac", "\u00a6"], ["1", "!"], ["2", '"'], ["3", "\u00a3"], ["4", "$", "\u20ac"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P"], ["[", "{"], ["]", "}"], ["Enter", "Enter"]],
[["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", "@"], ["#", "~"]],
[["Shift", "Shift"], ["\\", "|"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["AltGr", "AltGr"]]
];
this.VKI_layout.US = [ // US Standard Keyboard
[["`", "~"], ["1", "!"], ["2", "@"], ["3", "#"], ["4", "$"], ["5", "%"], ["6", "^"], ["7", "&"], ["8", "*"], ["9", "("], ["0", ")"], ["-", "_"], ["=", "+"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q"], ["w", "W"], ["e", "E"], ["r", "R"], ["t", "T"], ["y", "Y"], ["u", "U"], ["i", "I"], ["o", "O"], ["p", "P"], ["[", "{"], ["]", "}"], ["\\", "|"]],
[["Caps", "Caps"], ["a", "A"], ["s", "S"], ["d", "D"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L"], [";", ":"], ["'", '"'], ["Enter", "Enter"]],
[["Shift", "Shift"], ["z", "Z"], ["x", "X"], ["c", "C"], ["v", "V"], ["b", "B"], ["n", "N"], ["m", "M"], [",", "<"], [".", ">"], ["/", "?"], ["Shift", "Shift"]],
[[" ", " "]]
];
this.VKI_layout["US Int'l"] = [ // US International Keyboard
[["`", "~"], ["1", "!", "\u00a1", "\u00b9"], ["2", "@", "\u00b2"], ["3", "#", "\u00b3"], ["4", "$", "\u00a4", "\u00a3"], ["5", "%", "\u20ac"], ["6", "^", "\u00bc"], ["7", "&", "\u00bd"], ["8", "*", "\u00be"], ["9", "(", "\u2018"], ["0", ")", "\u2019"], ["-", "_", "\u00a5"], ["=", "+", "\u00d7", "\u00f7"], ["Bksp", "Bksp"]],
[["Tab", "Tab"], ["q", "Q", "\u00e4", "\u00c4"], ["w", "W", "\u00e5", "\u00c5"], ["e", "E", "\u00e9", "\u00c9"], ["r", "R", "\u00ae"], ["t", "T", "\u00fe", "\u00de"], ["y", "Y", "\u00fc", "\u00dc"], ["u", "U", "\u00fa", "\u00da"], ["i", "I", "\u00ed", "\u00cd"], ["o", "O", "\u00f3", "\u00d3"], ["p", "P", "\u00f6", "\u00d6"], ["[", "{", "\u00ab"], ["]", "}", "\u00bb"], ["\\", "|", "\u00ac", "\u00a6"]],
[["Caps", "Caps"], ["a", "A", "\u00e1", "\u00c1"], ["s", "S", "\u00df", "\u00a7"], ["d", "D", "\u00f0", "\u00d0"], ["f", "F"], ["g", "G"], ["h", "H"], ["j", "J"], ["k", "K"], ["l", "L", "\u00f8", "\u00d8"], [";", ":", "\u00b6", "\u00b0"], ["'", '"', "\u00b4", "\u00a8"], ["Enter", "Enter"]],
[["Shift", "Shift"], ["z", "Z", "\u00e6", "\u00c6"], ["x", "X"], ["c", "C", "\u00a9", "\u00a2"], ["v", "V"], ["b", "B"], ["n", "N", "\u00f1", "\u00d1"], ["m", "M", "\u00b5"], [",", "<", "\u00e7", "\u00c7"], [".", ">"], ["/", "?", "\u00bf"], ["Shift", "Shift"]],
[[" ", " ", " ", " "], ["Alt", "Alt"]]
];
/* ***** Define Dead Keys **************************************** */
this.VKI_deadkey = new Object();
// - Lay out each dead key set in one row of sub-arrays. The rows
// below are wrapped so uppercase letters are below their lowercase
// equivalents.
//
// - The first letter in each sub-array is the letter pressed after
// the diacritic. The second letter is the letter this key-combo
// will generate.
//
// - Note that if you have created a new keyboard layout and want it
// included in the distributed script, PLEASE TELL ME if you have
// added additional dead keys to the ones below.
this.VKI_deadkey['"'] = this.VKI_deadkey['\u00a8'] = [ // Umlaut / Diaeresis / Greek Dialytika
["a", "\u00e4"], ["e", "\u00eb"], ["i", "\u00ef"], ["o", "\u00f6"], ["u", "\u00fc"], ["y", "\u00ff"], ["\u03b9", "\u03ca"], ["\u03c5", "\u03cb"],
["A", "\u00c4"], ["E", "\u00cb"], ["I", "\u00cf"], ["O", "\u00d6"], ["U", "\u00dc"], ["Y", "\u0178"], ["\u0399", "\u03aa"], ["\u03a5", "\u03ab"]
];
this.VKI_deadkey['~'] = [ // Tilde
["a", "\u00e3"], ["o", "\u00f5"], ["n", "\u00f1"],
["A", "\u00c3"], ["O", "\u00d5"], ["N", "\u00d1"]
];
this.VKI_deadkey['^'] = [ // Circumflex
["a", "\u00e2"], ["e", "\u00ea"], ["i", "\u00ee"], ["o", "\u00f4"], ["u", "\u00fb"], ["w", "\u0175"], ["y", "\u0177"],
["A", "\u00c2"], ["E", "\u00ca"], ["I", "\u00ce"], ["O", "\u00d4"], ["U", "\u00db"], ["W", "\u0174"], ["Y", "\u0176"]
];
this.VKI_deadkey['\u02c7'] = [ // Baltic caron
["c", "\u010D"], ["s", "\u0161"], ["z", "\u017E"], ["r", "\u0159"], ["d", "\u010f"], ["t", "\u0165"], ["n", "\u0148"], ["l", "\u013e"], ["e", "\u011b"],
["C", "\u010C"], ["S", "\u0160"], ["Z", "\u017D"], ["R", "\u0158"], ["D", "\u010e"], ["T", "\u0164"], ["N", "\u0147"], ["L", "\u013d"], ["E", "\u011a"]
];
this.VKI_deadkey['\u02d8'] = [ // Romanian and Turkish breve
["a", "\u0103"], ["g", "\u011f"],
["A", "\u0102"], ["G", "\u011e"]
];
this.VKI_deadkey['`'] = [ // Grave
["a", "\u00e0"], ["e", "\u00e8"], ["i", "\u00ec"], ["o", "\u00f2"], ["u", "\u00f9"],
["A", "\u00c0"], ["E", "\u00c8"], ["I", "\u00cc"], ["O", "\u00d2"], ["U", "\u00d9"]
];
this.VKI_deadkey["'"] = this.VKI_deadkey['\u00b4'] = this.VKI_deadkey['\u0384'] = [ // Acute / Greek Tonos
["a", "\u00e1"], ["e", "\u00e9"], ["i", "\u00ed"], ["o", "\u00f3"], ["u", "\u00fa"], ["\u03b1", "\u03ac"], ["\u03b5", "\u03ad"], ["\u03b7", "\u03ae"], ["\u03b9", "\u03af"], ["\u03bf", "\u03cc"], ["\u03c5", "\u03cd"], ["\u03c9", "\u03ce"],
["A", "\u00c1"], ["E", "\u00c9"], ["I", "\u00cd"], ["O", "\u00d3"], ["U", "\u00da"], ["\u0391", "\u0386"], ["\u0395", "\u0388"], ["\u0397", "\u0389"], ["\u0399", "\u038a"], ["\u039f", "\u038c"], ["\u03a5", "\u038e"], ["\u03a9", "\u038f"]
];
this.VKI_deadkey['\u02dd'] = [ // Hungarian Double Acute Accent
["o", "\u0151"], ["u", "\u0171"],
["O", "\u0150"], ["U", "\u0170"]
];
this.VKI_deadkey["\u0385"] = [ // Greek Dialytika + Tonos
["\u03b9", "\u0390"], ["\u03c5", "\u03b0"]
];
this.VKI_deadkey['\u00b0'] = this.VKI_deadkey['\u00ba'] = [ // Ring
["a", "\u00e5"],
["A", "\u00c5"]
];
/* ***** Find tagged input & textarea elements ******************* */
var inputElems = [
document.getElementsByTagName('input'),
document.getElementsByTagName('textarea'),
]
for (var x = 0, inputCount = 0, elem; elem = inputElems[x++];) {
if (elem) {
for (var y = 0, keyid = "", ex; ex = elem[y++];) {
if ((ex.nodeName == "TEXTAREA" || ex.type == "text" || ex.type == "password") && ex.className.indexOf("keyboardInput") > -1) {
if (!ex.id) {
do { keyid = 'keyboardInputInitiator' + inputCount++; } while (document.getElementById(keyid));
ex.id = keyid;
} else keyid = ex.id;
var keybut = document.createElement('img');
keybut.src = "keyboard.png";
keybut.alt = "Keyboard interface";
keybut.className = "keyboardInputInitiator";
keybut.title = "Display graphical keyboard interface";
keybut.onclick = (function(a) { return function() { self.VKI_show(a); }; })(keyid);
ex.parentNode.insertBefore(keybut, ex.nextSibling);
if (!window.sidebar && !window.opera) {
ex.onclick = ex.onkeyup = ex.onselect = function() {
if (self.VKI_target.createTextRange) self.VKI_range = document.selection.createRange();
};
}
}
}
}
}
/* ***** Build the keyboard interface **************************** */
this.VKI_keyboard = document.createElement('table');
this.VKI_keyboard.id = "keyboardInputMaster";
this.VKI_keyboard.cellSpacing = this.VKI_keyboard.cellPadding = this.VKI_keyboard.border = "0";
var layouts = 0;
for (ktype in this.VKI_layout) if (typeof this.VKI_layout[ktype] == "object") layouts++;
var thead = document.createElement('thead');
var tr = document.createElement('tr');
var th = document.createElement('th');
if (layouts > 1) {
var kblist = document.createElement('select');
for (ktype in this.VKI_layout) {
if (typeof this.VKI_layout[ktype] == "object") {
var opt = document.createElement('option');
opt.value = ktype;
opt.appendChild(document.createTextNode(ktype));
kblist.appendChild(opt);
}
}
kblist.value = this.VKI_kt;
kblist.onchange = function() {
self.VKI_kt = this.value;
self.VKI_buildKeys();
self.VKI_position();
};
th.appendChild(kblist);
}
var label = document.createElement('label');
var checkbox = document.createElement('input');
checkbox.type = "checkbox";
checkbox.checked = this.VKI_deadkeysOn;
checkbox.title = "Toggle dead key input";
checkbox.onclick = function() {
self.VKI_deadkeysOn = this.checked;
this.nextSibling.nodeValue = " Dead keys: " + ((this.checked) ? "On" : "Off");
self.VKI_modify("");
return true;
};
label.appendChild(checkbox);
label.appendChild(document.createTextNode(" Dead keys: " + ((checkbox.checked) ? "On" : "Off")))
th.appendChild(label);
tr.appendChild(th);
var td = document.createElement('td');
var clearer = document.createElement('span');
clearer.id = "keyboardInputClear";
clearer.appendChild(document.createTextNode("Clear"));
clearer.title = "Clear this input";
clearer.onmousedown = function() { this.className = "pressed"; };
clearer.onmouseup = function() { this.className = ""; };
clearer.onclick = function() {
self.VKI_target.value = "";
self.VKI_target.focus();
return false;
};
td.appendChild(clearer);
var closer = document.createElement('span');
closer.id = "keyboardInputClose";
closer.appendChild(document.createTextNode('X'));
closer.title = "Close this window";
closer.onmousedown = function() { this.className = "pressed"; };
closer.onmouseup = function() { this.className = ""; };
closer.onclick = function() { self.VKI_close(); };
td.appendChild(closer);
tr.appendChild(td);
thead.appendChild(tr);
this.VKI_keyboard.appendChild(thead);
var tbody = document.createElement('tbody');
var tr = document.createElement('tr');
var td = document.createElement('td');
td.colSpan = "2";
var div = document.createElement('div');
div.id = "keyboardInputLayout";
td.appendChild(div);
var div = document.createElement('div');
var ver = document.createElement('var');
ver.appendChild(document.createTextNode("v" + this.VKI_version));
div.appendChild(ver);
td.appendChild(div);
tr.appendChild(td);
tbody.appendChild(tr);
this.VKI_keyboard.appendChild(tbody);
/* ***** Functions ************************************************ */
/* ******************************************************************
* Build or rebuild the keyboard keys
*
*/
this.VKI_buildKeys = function() {
this.VKI_shift = this.VKI_capslock = this.VKI_alternate = this.VKI_dead = false;
this.VKI_deadkeysOn = (this.VKI_layoutDDK[this.VKI_kt]) ? false : this.VKI_keyboard.getElementsByTagName('label')[0].getElementsByTagName('input')[0].checked;
var container = this.VKI_keyboard.tBodies[0].getElementsByTagName('div')[0];
while (container.firstChild) container.removeChild(container.firstChild);
for (var x = 0, hasDeadKey = false, lyt; lyt = this.VKI_layout[this.VKI_kt][x++];) {
var table = document.createElement('table');
table.cellSpacing = table.cellPadding = table.border = "0";
if (lyt.length <= this.VKI_keyCenter) table.className = "keyboardInputCenter";
var tbody = document.createElement('tbody');
var tr = document.createElement('tr');
for (var y = 0, lkey; lkey = lyt[y++];) {
if (!this.VKI_layoutDDK[this.VKI_kt] && !hasDeadKey)
for (var z = 0; z < lkey.length; z++)
if (this.VKI_deadkey[lkey[z]]) hasDeadKey = true;
var td = document.createElement('td');
td.appendChild(document.createTextNode(lkey[0]));
var alive = false;
if (this.VKI_deadkeysOn) for (key in this.VKI_deadkey) if (key === lkey[0]) alive = true;
td.className = (alive) ? "alive" : "";
if (lyt.length > this.VKI_keyCenter && y == lyt.length)
td.className += " last";
if (lkey[0] == " ")
td.style.paddingLeft = td.style.paddingRight = "50px";
td.onmouseover = function() { if (this.className != "dead" && this.firstChild.nodeValue != "\xa0") this.className += " hover"; };
td.onmouseout = function() { if (this.className != "dead") this.className = this.className.replace(/ ?(hover|pressed)/g, ""); };
td.onmousedown = function() { if (this.className != "dead" && this.firstChild.nodeValue != "\xa0") this.className += " pressed"; };
td.onmouseup = function() { if (this.className != "dead") this.className = this.className.replace(/ ?pressed/g, ""); };
td.ondblclick = function() { return false; };
switch (lkey[1]) {
case "Caps":
case "Shift":
case "Alt":
case "AltGr":
td.onclick = (function(type) { return function() { self.VKI_modify(type); return false; }})(lkey[1]);
break;
case "Tab":
td.onclick = function() { self.VKI_insert("\t"); return false; };
break;
case "Bksp":
td.onclick = function() {
self.VKI_target.focus();
if (self.VKI_target.setSelectionRange) {
var srt = self.VKI_target.selectionStart;
var len = self.VKI_target.selectionEnd;
if (srt < len) srt++;
self.VKI_target.value = self.VKI_target.value.substr(0, srt - 1) + self.VKI_target.value.substr(len);
self.VKI_target.setSelectionRange(srt - 1, srt - 1);
} else if (self.VKI_target.createTextRange) {
try { self.VKI_range.select(); } catch(e) {}
self.VKI_range = document.selection.createRange();
if (!self.VKI_range.text.length) self.VKI_range.moveStart('character', -1);
self.VKI_range.text = "";
} else self.VKI_target.value = self.VKI_target.value.substr(0, self.VKI_target.value.length - 1);
if (self.VKI_shift) self.VKI_modify("Shift");
if (self.VKI_alternate) self.VKI_modify("AltGr");
return true;
};
break;
case "Enter":
td.onclick = function() {
if (self.VKI_target.nodeName == "TEXTAREA") { self.VKI_insert("\n"); } else self.VKI_close();
return true;
};
break;
default:
td.onclick = function() {
if (self.VKI_deadkeysOn && self.VKI_dead) {
if (self.VKI_dead != this.firstChild.nodeValue) {
for (key in self.VKI_deadkey) {
if (key == self.VKI_dead) {
if (this.firstChild.nodeValue != " ") {
for (var z = 0, rezzed = false, dk; dk = self.VKI_deadkey[key][z++];) {
if (dk[0] == this.firstChild.nodeValue) {
self.VKI_insert(dk[1]);
rezzed = true;
break;
}
}
} else {
self.VKI_insert(self.VKI_dead);
rezzed = true;
}
break;
}
}
} else rezzed = true;
}
self.VKI_dead = false;
if (!rezzed && this.firstChild.nodeValue != "\xa0") {
if (self.VKI_deadkeysOn) {
for (key in self.VKI_deadkey) {
if (key == this.firstChild.nodeValue) {
self.VKI_dead = key;
this.className = "dead";
if (self.VKI_shift) self.VKI_modify("Shift");
if (self.VKI_alternate) self.VKI_modify("AltGr");
break;
}
}
if (!self.VKI_dead) self.VKI_insert(this.firstChild.nodeValue);
} else self.VKI_insert(this.firstChild.nodeValue);
}
self.VKI_modify("");
return false;
};
}
tr.appendChild(td);
tbody.appendChild(tr);
table.appendChild(tbody);
for (var z = lkey.length; z < 4; z++) lkey[z] = "\xa0";
}
container.appendChild(table);
}
this.VKI_keyboard.getElementsByTagName('label')[0].style.display = (hasDeadKey) ? "inline" : "none";
};
this.VKI_buildKeys();
VKI_disableSelection(this.VKI_keyboard);
/* ******************************************************************
* Controls modifier keys
*
*/
this.VKI_modify = function(type) {
switch (type) {
case "Alt":
case "AltGr": this.VKI_alternate = !this.VKI_alternate; break;
case "Caps": this.VKI_capslock = !this.VKI_capslock; break;
case "Shift": this.VKI_shift = !this.VKI_shift; break;
}
var vchar = 0;
if (!this.VKI_shift != !this.VKI_capslock) vchar += 1;
var tables = this.VKI_keyboard.getElementsByTagName('table');
for (var x = 0; x < tables.length; x++) {
var tds = tables[x].getElementsByTagName('td');
for (var y = 0; y < tds.length; y++) {
var dead = alive = target = false;
var lkey = this.VKI_layout[this.VKI_kt][x][y];
switch (lkey[1]) {
case "Alt":
case "AltGr":
if (this.VKI_alternate) dead = true;
break;
case "Shift":
if (this.VKI_shift) dead = true;
break;
case "Caps":
if (this.VKI_capslock) dead = true;
break;
case "Tab": case "Enter": case "Bksp": break;
default:
if (type) tds[y].firstChild.nodeValue = lkey[vchar + ((this.VKI_alternate && lkey.length == 4) ? 2 : 0)];
if (this.VKI_deadkeysOn) {
var char = tds[y].firstChild.nodeValue;
if (this.VKI_dead) {
if (char == this.VKI_dead) dead = true;
for (var z = 0; z < this.VKI_deadkey[this.VKI_dead].length; z++)
if (char == this.VKI_deadkey[this.VKI_dead][z][0]) { target = true; break; }
}
for (key in this.VKI_deadkey) if (key === char) { alive = true; break; }
}
}
tds[y].className = (dead) ? "dead" : ((target) ? "target" : ((alive) ? "alive" : ""));
if (y == tds.length - 1 && tds.length > this.VKI_keyCenter) tds[y].className += " last";
}
}
this.VKI_target.focus();
};
/* ******************************************************************
* Insert text at the cursor
*
*/
this.VKI_insert = function(text) {
this.VKI_target.focus();
if (this.VKI_target.setSelectionRange) {
var srt = this.VKI_target.selectionStart;
var len = this.VKI_target.selectionEnd;
this.VKI_target.value = this.VKI_target.value.substr(0, srt) + text + this.VKI_target.value.substr(len);
if (text == "\n" && window.opera) srt++;
this.VKI_target.setSelectionRange(srt + text.length, srt + text.length);
} else if (this.VKI_target.createTextRange) {
try { this.VKI_range.select(); } catch(e) {}
this.VKI_range = document.selection.createRange();
this.VKI_range.text = text;
this.VKI_range.collapse(true);
this.VKI_range.select();
} else this.VKI_target.value += text;
if (this.VKI_shift) this.VKI_modify("Shift");
if (this.VKI_alternate) this.VKI_modify("AltGr");
this.VKI_target.focus();
};
/* ******************************************************************
* Show the keyboard interface
*
*/
this.VKI_show = function(id) {
if (this.VKI_target = document.getElementById(id)) {
if (this.VKI_visible != id) {
this.VKI_range = "";
try { this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard); } catch (e) {}
var elem = this.VKI_target;
this.VKI_target.keyboardPosition = "absolute";
do {
if (VKI_getStyle(elem, "position") == "fixed") {
this.VKI_target.keyboardPosition = "fixed";
break;
}
} while (elem = elem.offsetParent);
this.VKI_keyboard.style.top = this.VKI_keyboard.style.right = this.VKI_keyboard.style.bottom = this.VKI_keyboard.style.left = "auto";
this.VKI_keyboard.style.position = this.VKI_target.keyboardPosition;
document.body.appendChild(this.VKI_keyboard);
this.VKI_visible = this.VKI_target.id;
this.VKI_position();
this.VKI_target.focus();
} else this.VKI_close();
}
};
/* ******************************************************************
* Position the keyboard
*
*/
this.VKI_position = function() {
if (self.VKI_visible != "") {
var inputElemPos = VKI_findPos(self.VKI_target);
self.VKI_keyboard.style.top = inputElemPos[1] - ((self.VKI_target.keyboardPosition == "fixed") ? document.body.scrollTop : 0) + self.VKI_target.offsetHeight + 3 + "px";
self.VKI_keyboard.style.left = Math.min(VKI_innerDimensions()[0] - self.VKI_keyboard.offsetWidth - 15, inputElemPos[0]) + "px";
}
};
if (window.addEventListener) {
window.addEventListener('resize', this.VKI_position, false);
} else if (window.attachEvent)
window.attachEvent('onresize', this.VKI_position);
/* ******************************************************************
* Close the keyboard interface
*
*/
this.VKI_close = function() {
try { this.VKI_keyboard.parentNode.removeChild(this.VKI_keyboard); } catch (e) {}
this.VKI_visible = "";
this.VKI_target.focus();
this.VKI_target = "";
};
}
/* ***** Attach this script to the onload event ******************** */
if (window.addEventListener) {
window.addEventListener('load', VKI_buildKeyboardInputs, false);
} else if (window.attachEvent)
window.attachEvent('onload', VKI_buildKeyboardInputs);
function VKI_findPos(obj) {
var curleft = curtop = 0;
do {
curleft += obj.offsetLeft;
curtop += obj.offsetTop;
} while (obj = obj.offsetParent);
return [curleft, curtop];
}
function VKI_innerDimensions() {
if (self.innerHeight) {
return [self.innerWidth, self.innerHeight];
} else if (document.documentElement && document.documentElement.clientHeight) {
return [document.documentElement.clientWidth, document.documentElement.clientHeight];
} else if (document.body)
return [document.body.clientWidth, document.body.clientHeight];
return [0, 0];
}
function VKI_getStyle(obj, styleProp) {
if (obj.currentStyle) {
var y = obj.currentStyle[styleProp];
} else if (window.getComputedStyle)
var y = window.getComputedStyle(obj, null)[styleProp];
return y;
}
function VKI_disableSelection(elem) {
elem.onselectstart = function() { return false; };
elem.unselectable = "on";
elem.style.MozUserSelect = "none";
elem.style.cursor = "default";
if (window.opera) elem.onmousedown = function() { return false; };
}
</script>
Step 3: Place HTML below in your BODY section
HTML
Code:
<input type="text" value="" class="keyboardInput">
Step 4: must download files below
Files
keyboard.png