Home  | Articles, Tips & Tutorials Library  | Q&As  | Web Hosting Tips  | Useful Tools & Resources  | Online Business Dictionary  | Home Based Work  

12 Useful HTML and Javascript Tricks (Part 4)


8. Create a "Buy Now!" Mentality with Automatic Moving Deadlines

You've probably seen websites that say something like:

Hurry! This incredible 50% discount ends at midnight on !

Then whenever you go back to the site, you'll see that the deadline has been moved to whatever today's date is. The point of using such a technique is to create a sense of urgency in the customer, ie. the customer doesn't want to "miss out" on a great special, so he buys immediately to make sure he gets the "discount."

This trick is done by using a small script. Here's the code; copy and paste it wherever you want the date displayed.

<SCRIPT>
var todaydate=new Date()
var year=todaydate.getYear()
if (year < 1000) year+=1900
var day=todaydate.getDay()
var month=todaydate.getMonth()

var dayofmonth=todaydate.getDate()
if (dayofmonth < 10) dayofmonth="0"+dayofmonth

var dayarray=new Array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

var montharray=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

document.write(""+dayarray[day]+" "+montharray[month]+" "+dayofmonth+", "+year+"")
</SCRIPT>

Before using this technique, consider how your visitors will feel if they were to purchase your product because they didn't want to miss out on a "good deal"… only to return to your site later on, and see that they can still get your product for the same price! Making sales is great, of course, but the lifetime value of a customer is important too.

PREVIOUS: 12 Useful HTML and Javascript Tricks (Part 3)
NEXT: 12 Useful HTML and Javascript Tricks (Part 5)


© Copyright 2004, onlinebusinessbasics.com. All Rights Reserved.

Please contact us to request reprint permission.

© Copyright 2002-2009, Online Business Basicstm. All Rights Reserved.
Privacy Policy