Register on the forum now to remove ALL ads + popups + get access to tons of hidden content for members only!

Go Back   Site Owners Forums - Webmaster Forums > Web Programming > Programming General > Javascript

Notices


Reply
 
Thread Tools Rate Thread Display Modes
Old 05-20-2013, 10:29 PM   #1
JavaScriptBank
Registered User
 
Join Date: Jul 2009
Posts: 190
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 at JavaScriptBank.com - 2.000+ free JavaScript codes


How to setup

Step 1: Use CSS code below for styling the script
CSS
Code:
<style type="text/css">
/*
     This script downloaded from www.JavaScriptBank.com
     Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
*/

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
Code:
<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: Copy & Paste HTML code below in your BODY section
HTML
Code:
<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>





JavaScriptBank is offline   Reply With Quote

Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
The power of forum signature links kajal.pillai22 Search Engine Optimization 16 12-28-2014 09:36 PM
Affiliate links cloaking? Necessary? How? wryfhk22 Making money on the web 9 12-28-2014 12:56 PM
Featured Links for free at Fast-directory lovelygrl Web Promotion 13 05-27-2014 12:43 AM
Free Awesome jQuery Count Down/Up Timer Scripts JavaScriptBank Javascript 0 04-09-2013 06:09 AM
Google notice of unnatural links detected 101 Mark Jackson Google 2 11-04-2012 10:01 PM


All times are GMT -7. The time now is 08:54 AM.


Powered by vBulletin Copyright © 2013 vBulletin Solutions, Inc.