PDA

View Full Version : Helpful JavaScripts to develop website



JavaScriptBank
05-21-2013, 02:57 AM
Free JavaSccript codes

Javascript Countdown Timer redirecting Affiliate Links

With this simple JavaScript countdown timer, you will easily notice to visitors that the link will be redirected. This JavaScript script is quite short and very easy to modify as you want; so this cod... detail (http://www.javascriptbank.com/javascript-countdown-timer-redirecting-affiliate-links.html/en//) at JavaScriptBank.com - 2.000+ free JavaScript codes (http://www.javascriptbank.com/)


http://www.javascriptbank.com/javascript.images/time/javascript-countdown-timer-redirecting-affiliate-links.jpg (http://www.javascriptbank.com/javascript/time/counter/javascript-countdown-timer-redirecting-affiliate-links/preview/en/)
Demo: JavaScript Javascript Countdown Timer redirecting Affiliate Links (http://www.javascriptbank.com/javascript-countdown-timer-redirecting-affiliate-links.html/en/)


How to setup

Step 1: Copy & Paste CSS code below in your HEAD section
CSS

<style type="text/css">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/

body {
color: black;
background: white;
font: bold 18pt Verdana, Arial, Helvetica, sans-serif;
text-align: center;
}

span.counter {
color: red;
cursor: default;
font-size: larger;
}

div.info {
margin: 0 auto;
text-align: left;
font-size: smaller;
width: 80%;
margin-top: 2em;
}
</style>

Step 2: Copy & Paste JavaScript code below in your HEAD section
JavaScript

<script name="countdownRedirect.js" type="text/javascript">
/*
This script downloaded from www.JavaScriptBank.com
Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/

/**
* Copyright (C) 2006-2009, QuietAffiliate.com. All rights reserved.
*
* Script Name: Countdown Redirect
*
* THIS SOURCE CODE MAY BE USED FREELY PROVIDED THAT
* YOU DO NOT REMOVE THIS MESSAGE.
*
* You can obtain this script at http://www.QuietAffiliate.com
*/

function countdownRedirect(url, msg)
{
var TARG_ID = "COUNTDOWN_REDIRECT";
var DEF_MSG = "Redirecting...";

if( ! msg )
{
msg = DEF_MSG;
}

if( ! url )
{
throw new Error('You didn\'t include the "url" parameter');
}


var e = document.getElementById(TARG_ID);

if( ! e )
{
throw new Error('"COUNTDOWN_REDIRECT" element id not found');
}

var cTicks = parseInt(e.innerHTML);

var timer = setInterval(function()
{
if( cTicks )
{
e.innerHTML = --cTicks;
}
else
{
clearInterval(timer);
document.body.innerHTML = msg;
location = url;
}

}, 1000);
}

window.onload = function() {
countdownRedirect("http://www.javascriptbank.com", "Thanks For Visiting")
}
</script>

Step 3: Place HTML below in your BODY section
HTML

<div class="info">This is a demo page of the redirect script in action, code and instructions can be found at <strong>QuietAffiliate.com</strong><br /><br /><center>You will automatically be redirected in <span class="counter" id="COUNTDOWN_REDIRECT">10</span> seconds.</center>
</div>







JavaScript Make link open in new tab/window (http://www.javascriptbank.com/make-link-open-in-new-tab-window.html/en/) - JavaScript World clock (http://www.javascriptbank.com/world-clock-with-unique-display.html/en/) - circumference calculator (http://www.javascriptbank.com/circumference-calculator.html/en/)


The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.

hansa
05-21-2013, 03:25 AM
do you have java CMS in your scripts?

noahwilson
05-21-2013, 07:32 AM
So nice post, really java script is so helpful to make website user friendly, like set validation on form and other like events . its really a best and interesting language.

bestbloggercafe
05-26-2013, 02:29 PM
thanks great sharing