Disable right mouse click script
This is a cross browser DHTML script that will prevent the default right [URL="http://www.javascriptbank.com/javascript/menu/"]JavaScript... detail
How to setup
Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<SCRIPT language=JavaScript type=text/javascript>
<!--
function opendetailwindow() {
window.open('','detailwindow','toolbar=no,scrollbars=yes,resizable=no,width=680,height=480');
}
function right(e) {
if (navigator.appName == 'Netscape' && (e.which == 2 || e.which == 3)) {
alert('© Copyright by iuem');
return false;
}
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button==2 || event.button == 3)) {
alert('This script disable right click');
return false;
}
return true;
}
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
// -->
</SCRIPT>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Multilevel Drop Down Horizontal Navigation
This code uses both CSS and JavaScript for creating multilevel drop down navigation menus, submenus will appear when users move mouse over the... detail
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
#dd {
margin-left: 25%;
padding: 0 0 20px 0;
}
#dd li {
margin: 0;
padding: 0;
list-style: none;
float: left;
font: bold 11px arial;
}
#dd li a.menu {
display: block;
text-align: center;
background: #5970B2;
padding: 4px 10px;
margin: 0 1px 0 0;
color: #FFF;
width: 60px;
text-decoration: none;
}
#dd li a.menu:hover {
background: #49A3FF;
}
.submenu {
background: #EAEBD8;
border: 1px solid #5970B2;
visibility: hidden;
position: absolute;
z-index: 3;
}
.submenu a {
display: block;
font: 11px arial;
text-align: left;
text-decoration: none;
padding: 5px;
color: #2875DE;
}
.submenu a:hover {
background: #49A3FF;
color: #FFF;
}
</style>
Step 2: Use JavaScript code below to setup the script
JavaScript
Code:
<script type="text/javascript">
// Created by: Konstantin Jagello | http://javascript-array.com/
var TimeOut = 300;
var currentLayer = null;
var currentitem = null;
var currentLayerNum = 0;
var noClose = 0;
var closeTimer = null;
function mopen(n) {
var l = document.getElementById("menu"+n);
var mm = document.getElementById("mmenu"+n);
if(l) {
mcancelclosetime();
l.style.visibility='visible';
if(currentLayer && (currentLayerNum != n))
currentLayer.style.visibility='hidden';
currentLayer = l;
currentitem = mm;
currentLayerNum = n;
} else if(currentLayer) {
currentLayer.style.visibility='hidden';
currentLayerNum = 0;
currentitem = null;
currentLayer = null;
}
}
function mclosetime() {
closeTimer = window.setTimeout(mclose, TimeOut);
}
function mcancelclosetime() {
if(closeTimer) {
window.clearTimeout(closeTimer);
closeTimer = null;
}
}
function mclose() {
if(currentLayer && noClose!=1) {
currentLayer.style.visibility='hidden';
currentLayerNum = 0;
currentLayer = null;
currentitem = null;
} else {
noClose = 0;
}
currentLayer = null;
currentitem = null;
}
document.onclick = mclose;
</script>
Step 3: Copy & Paste HTML code below in your BODY section
HTML
Code:
<ul id="dd">
<li><a href="#" class="menu" id="mmenu1"
onmouseover="mopen(1);"
onmouseout="mclosetime();">Home</a>
<div class="submenu" id="menu1"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime();">
<a href="http://javascriptbank.com/">HTML Tutorials</a>
<a href="http://javascriptbank.com/">DHTML Tutorials</a>
<a href="http://javascriptbank.com/">JavaScript Tutorials</a>
<a href="http://javascriptbank.com/">CSS Tutorials</a>
</div>
</li>
<li><a href="#" class="menu" id="mmenu2"
onmouseover="mopen(2);"
onmouseout="mclosetime();">Download</a>
<div class="submenu" id="menu2"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime();">
<a href="http://javascriptbank.com/">ASP Scripts</a>
<a href="http://javascriptbank.com/">PHP Scripts</a>
<a href="http://javascriptbank.com/">Ajax Scripts</a>
<a href="http://javascriptbank.com/">Perl Scripts</a>
</div>
</li>
<li><a href="#" class="menu">Order</a></li>
<li><a href="#" class="menu">Help</a></li>
<li><a href="#" class="menu" id="mmenu3"
onmouseover="mopen(3);"
onmouseout="mclosetime();">Contact</a>
<div class="submenu" id="menu3"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime();">
<a href="http://javascriptbank.com/">Office</a>
<a href="http://javascriptbank.com/">Sales</a>
<a href="http://javascriptbank.com/">Customer Service</a>
<a href="http://javascriptbank.com/">Shipping</a>
</div>
</li>
</ul>
JavaScript Countdown Timer
This JavaScript displays a countdown timer and alerts the user when the timer reaches zero. It then redirects to another Web ... detail
How to setup
Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
#txt {
border:none;
font-family:verdana;
font-size:16pt;
font-weight:bold;
border-right-color:#FFFFFF
}
</style>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Step 2: Use JavaScript code below to setup the script
JavaScript
Code:
<script language="javascript">
// Created by: Neill Broderick :: http://www.bespoke-software-solutions.co.uk/downloads/downjs.php
var mins
var secs;
function cd() {
mins = 1 * m("10"); // change minutes here
secs = 0 + s(":01"); // change seconds here (always add an additional second to your total)
redo();
}
function m(obj) {
for(var i = 0; i < obj.length; i++) {
if(obj.substring(i, i + 1) == ":")
break;
}
return(obj.substring(0, i));
}
function s(obj) {
for(var i = 0; i < obj.length; i++) {
if(obj.substring(i, i + 1) == ":")
break;
}
return(obj.substring(i + 1, obj.length));
}
function dis(mins,secs) {
var disp;
if(mins <= 9) {
disp = " 0";
} else {
disp = " ";
}
disp += mins + ":";
if(secs <= 9) {
disp += "0" + secs;
} else {
disp += secs;
}
return(disp);
}
function redo() {
secs--;
if(secs == -1) {
secs = 59;
mins--;
}
document.cd.disp.value = dis(mins,secs); // setup additional displays here.
if((mins == 0) && (secs == 0)) {
window.alert("Time is up. Press OK to continue."); // change timeout message as required
// window.location = "yourpage.htm" // redirects to specified page once timer ends and ok button is pressed
} else {
cd = setTimeout("redo()",1000);
}
}
function init() {
cd();
}
window.onload = init;
</script>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Step 3: Copy & Paste HTML code below in your BODY section
HTML
Code:
<form name="cd">
<input id="txt" readonly="true" type="text" value="10:00" border="0" name="disp">
</form>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Image slideshow transition
This JavaScript creates slideshow effect with one of transitions.... detail
How to setup
Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script LANGUAGE="JavaScript1.1">
<!-- Beginning of JavaScript -
messages = new Array()
//anh dung de tao hieu ung
messages[0] = "<img src=logojs.gif>"
messages[1] = "<img src=photo1.jpg>"
messages[2] = "<img src=photo2.jpg>"
messages[3] = "<img src=photo3.jpg>"
messages[4] = "<img src=photo4.jpg>"
var i_messages = 0
var timer
function dotransition() {
if (document.all) {
content.filters[0].apply()
content.innerHTML = messages[i_messages]
content.filters[0].play()
if (i_messages >= messages.length-1) {
i_messages = 0
}
else {
i_messages++
}
}
if (document.layers) {
document.nn.document.write("<table cellspacing=2 cellpadding=2 border=0><tr><td align=left>"+messages[i_messages]+"</td></tr></table>")
document.close()
if (i_messages >= messages.length-1) {
i_messages = 0
}
else {
i_messages++
}
}
timer = setTimeout("dotransition()",5000)
}
// - End of JavaScript - -->
</script>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<BODY onload="dotransition()">
<DIV id=content style="position: relative; width:160px; height:240px; text-align:center; filter: revealTrans(Transition=12, Duration=3)"></DIV>
</BODY>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Make link open in new tab/window
Use this simple JavaScript to make all links on your web pages open in new tab/window. Script is easy to setup, you should save them into a f... detail
How to setup
Step 1: Copy & Paste JavaScript code below in your HEAD section
JavaScript
Code:
<script language=javascript>
/*
Kevin Yank
http://www.sitepoint.com/authorcontact/48
*/
function externalLinks()
{
if (!document.getElementsByTagName) return;
var anchors = document.getElementsByTagName("a");
for (var i=0; i<anchors.length; i++)
{
var anchor = anchors[i];
if(anchor.getAttribute("href"))
anchor.target = "_blank";
}
}
window.onload = externalLinks;
</script>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->
Step 2: Copy & Paste HTML code below in your BODY section
HTML
Code:
<a href="http://javascriptbank.com/">Home</a> |
<a href="http://javascriptbank.com/4rum/">Forum</a> |
<a href="http://javascriptbank.com/javascript/">JavaScript</a> |
<a href="http://javascriptbank.com/service/">Services</a> |
<a href="http://javascriptbank.com/javascript/submit-javascript-bank.html">Submit script</a> |
<a href="http://javascriptbank.com/thietkeweb/javascriptmall/">Documentary</a> |
<a href="http://javascriptbank.com/javascript/contact-javascript-bank.html">Contact us</a> |
<a href="http://javascriptbank.com/javascript/aboutus-javascript-bank.html">About us</a>
<!--
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
-->