|
Scripts and Tools Share your free scripts , tools , icons, fontz, screen savers , etc here. |
|
Thread Tools | Display Modes |
#151
|
|||
|
|||
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... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Place CSS below in your HEAD section CSS Code:
<style type="text/css"> .hidden { visibility: hidden; } </style> 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> HTML Code:
<div> <div> <div id="generated-toc"></div> <h1>foo</h1> <h2>bar</h2> </div> <h1>quux</h1> </div> |
#152
|
|||
|
|||
JavaScript Add-Remove HTML Elements with DOM
This [Only Registered users can see links . Click Here To Register...] will dynamically add/remove HTML elements with content included within them according to ... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Copy & Paste JavaScript code 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> HTML Code:
<div id="doc"> <p id="add-element">Add Elements</p> <div id="content"></div> </div> |
#153
|
|||
|
|||
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... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...] [Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: CSS below for styling thescript, place it into HEAD section CSS Code:
<style type="text/css"> #display { position: relative; left: 10px; width: 450px; border: 1px solid black; padding: 10px; } </style> 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> 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> |
#154
|
|||
|
|||
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... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: CSS below for styling thescript, place it into HEAD section 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> 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> 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> Files [Only Registered users can see links . Click Here To Register...] |
#155
|
|||
|
|||
JavaScript Dynamic Drop Down Values on Action
If your web pages have a huge list of options to show in the [Only Registered users can see links . Click Here To Register...] (listed into categories), why don't you consider to use this JavaScri... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Place JavaScript below in your HEAD section 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> 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> |
#156
|
|||
|
|||
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 ... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup |
#157
|
|||
|
|||
Simple JavaScript for Auto-Sum with Checkboxes
This JavaScript code example uses a for loop to calculate the sum of [Only Registered users can see links . Click Here To Register...]. This JavaScript will display a running total automatically wh... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] 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> 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> |
#158
|
|||
|
|||
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... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Use CSS code below for styling the script 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> 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> HTML Code:
<input type="text" value="" class="keyboardInput"> Files [Only Registered users can see links . Click Here To Register...] |
#159
|
|||
|
|||
Awesome jQuery Accordion with CSS3 and HTML5
This JavaScript-jQuery code example is suitable for websites with a huge list of categories (divided into subjects) need to be showed. This [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Use CSS code below for styling the script CSS Code:
<link rel='stylesheet' type='text/css' href='css/style.css' /> JavaScript Code:
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js'></script> <script type='text/javascript' src='js/infogrid.js'></script> HTML Code:
<div id="page-wrap"> <div class="info-col"> <h2>Superman</h2> <a class="image superman" href="http://jprart.deviantart.com/art/Batman-and-Superman-64545242">View Image</a> <dl> <dt>Super Power</dt> <dd><a href="http://css-tricks.com">Consectetur</a> adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Costume</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Morality</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Sidekicks</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Vehicles</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Weaknesses</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> </dl> </div> <div class="info-col"> <h2>Batman</h2> <a class="image batman" href="http://jprart.deviantart.com/">View Image</a> <dl> <dt>Super Power</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Costume</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Morality</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Sidekicks</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Vehicles</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Weaknesses</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> </dl> </div> <div class="info-col"> <h2>Aquaman</h2> <a class="image aquaman" href="http://www.deviantart.com/print/8342014/">View Image</a> <dl> <dt id="starter">Super Power</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Costume</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Morality</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Sidekicks</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Vehicles</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Weaknesses</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> </dl> </div> <div class="info-col"> <h2>Spiderman</h2> <a class="image spiderman" href="http://eldelgado.deviantart.com/">View Image</a> <dl> <dt>Super Power</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Costume</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Morality</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Sidekicks</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Vehicles</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Weaknesses</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> </dl> </div> <div class="info-col"> <h2>Ironman</h2> <a class="image ironman" href="http://diablo2003.deviantart.com/">View Image</a> <dl> <dt>Super Power</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Costume</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Morality</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Sidekicks</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Vehicles</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> <dt>Weaknesses</dt> <dd>Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</dd> </dl> </div> </div> Files [Only Registered users can see links . Click Here To Register...] |
#160
|
|||
|
|||
Simple Auto Image Rotator with jQuery
This is a simple JavaScript code example to rotate your pictures continuously. This jQuery code example uses the blur effects for the animations of picture transitions. A very easy JavaScript code exa... [Only Registered users can see links . Click Here To Register...] at [Only Registered users can see links . Click Here To Register...]
[Only Registered users can see links . Click Here To Register...] Demo: [Only Registered users can see links . Click Here To Register...] How to setup Step 1: Use CSS code below for styling the script CSS Code:
<style type="text/css"> /* rotator in-page placement */ div#rotator { position:relative; height:345px; margin-left: 15px; } /* rotator css */ div#rotator ul li { float:left; position:absolute; list-style: none; } /* rotator image style */ div#rotator ul li img { border:1px solid #ccc; padding: 4px; background: #FFF; } div#rotator ul li.show { z-index:500 } </style> JavaScript Code:
<script type="text/javascript" src="/javascript/jquery.js"></script> <!-- By Dylan Wagstaff, http://www.alohatechsupport.net --> <script type="text/javascript"> function theRotator() { //Set the opacity of all images to 0 $('div#rotator ul li').css({opacity: 0.0}); //Get the first image and display it (gets set to full opacity) $('div#rotator ul li:first').css({opacity: 1.0}); //Call the rotator function to run the slideshow, 6000 = change to next image after 6 seconds setInterval('rotate()',6000); } function rotate() { //Get the first image var current = ($('div#rotator ul li.show')? $('div#rotator ul li.show') : $('div#rotator ul li:first')); //Get next image, when it reaches the end, rotate it back to the first image var next = ((current.next().length) ? ((current.next().hasClass('show')) ? $('div#rotator ul li:first') :current.next()) : $('div#rotator ul li:first')); //Set the fade in effect for the next image, the show class has higher z-index next.css({opacity: 0.0}) .addClass('show') .animate({opacity: 1.0}, 1000); //Hide the current image current.animate({opacity: 0.0}, 1000) .removeClass('show'); }; $(document).ready(function() { //Load the slideshow theRotator(); }); </script> HTML Code:
<div id="rotator"> <ul> <li class="show"><a href="http://www.alohatechsupport.net/webdesignmaui/"><img src="image-1.jpg" width="500" height="313" alt="pic1" /></a></li> <li><a href="http://www.alohatechsupport.net/"><img src="image-2.jpg" width="500" height="313" alt="pic2" /></a></li> <li><a href="http://www.alohatechsupport.net/mauiwebdesign.html"><img src="image-3.jpg" width="500" height="313" alt="pic3" /></a></li> <li><a href="http://www.alohatechsupport.net/webdesignmaui/maui-web-site-design/easy_jquery_auto_image_rotator.html"><img src="image-4.jpg" width="500" height="313" alt="pic4" /></a></li> </ul> </div> Files [Only Registered users can see links . Click Here To Register...] [Only Registered users can see links . Click Here To Register...] [Only Registered users can see links . Click Here To Register...] [Only Registered users can see links . Click Here To Register...] [Only Registered users can see links . Click Here To Register...] |
Bookmarks |
Thread Tools | |
Display Modes | |
|
|