Tag Archives: javascript

JavaScript – Block email domain

Do you have forms on your website for people to submit sales information? Do you get personal email addresses when you’re looking for business email addresses? Blocking the personal email addresses can be very advantageous to your sales process and can provide a much needed filter on the leads coming in.

Here’s a nice JavaScript function that validates the domain of an email address against a list of predefined blacklisted domains. You add more domains simply add another item to domarray.   For instance you could have:

domarray[3] = “microsoft.”;

Additionally you can validate the domains as specific as possible:

domarray[3] = “gmail.jp”;
domarray[4] = “gmail.co.uk”;
domarray[5] = “gmail.kr”;

The Whole Script

function chckDomain(em) {
var emat = em.substring(0,em.lastIndexOf(‘@’)+1);
var emdom = em.substring(emat.length,em.length+1);
var emdom = emdom.toLowerCase();
var domarray = Array();
domarray[0] = “gmail.”;
domarray[1] = “hotmail.”;
domarray[2] = “yahoo.”;
for (i=0; i < domarray.length ; i++) {
if (emdom.indexOf(domarray[i]) != -1) {
return false;
return true;



Jquery Number Ticker

I work at MindTouch and earlier today I started looking around the web for an animated jQuery number ticker to display the real-time page views with ajax. After searching for a while I wasn’t able to find anything so I thought I might try to build one.

With jQuery it wasn’t too challenging and I was able to develop the ticker in no time at all. The script is flexible and adjusts to the number of digits in the number. It also adds commas to properly format the number. You can see how the ticker looks here displaying the number 786554 – Jquery Number Ticker - by Damien Howley.


The jQuery code creates and removes the digits as needed and of the css is responsible for positioning the digits. The ticker is animated with jQuery which adds a nice touch. I got the number comma formatting from mrededkj.com. You’ll also need the following image that I created.





.counter-wrap {
.counter-number {
background-image:url(IMAGE URL HERE);

Jquery Code

$(".counter-number").each( function(i) {
function loadinput() {
var newval = $("#numgo").val();
function loadticker(ticnum) {
var fticnum = add_commas(ticnum);
var numheight=18;
if (ticnum && ticnum != 0) {

var s = String(fticnum);

for (i=s.length;i>=0; i–)
var onum=s.charAt(i);

$(“.counter-number”).each( function() {
var nval=$(this).attr(“value”);
if (!isNaN(nval)) {
var nheight = Number(nval)*numheight*-1;
$(this).animate({ top: nheight+’px’}, 1500 );
if (nval==’,’){
$(this).animate({ top: ‘-180px’}, 1500 );
function addticker(newnum) {
var digitcnt = $(“.counter-number”).size();
var nnum = String(newnum).length;
var digitdiff = Number(nnum – Number(digitcnt));
if (digitdiff

function add_commas(nStr) {
nStr += ”;
x = nStr.split(‘.’);
x1 = x[0];
x2 = x.length > 1 ? ‘.’ + x[1] : ”;
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, ‘$1’ + ‘,’ + ‘$2’);
return x1 + x2;

Call the function

<a href="#" onclick="loadticker(786554)">load ticker - 786554</a>
<a href="#" onclick="loadticker(1767697234789837)">load ticker - 1767697234789837</a>
<a href="#" onclick="loadticker(1988989)">load ticker - 1988989</a>

I hope you enjoy this code, feel free to post any improvements as this was simply a prototype.