PDA

View Full Version : hotmail alert


edbr
05-10-2008, 02:03 AM
would it be possible to create an alert that when hotmail is added in a form field, a warning would pop up but the process would still continue. I am thinking 'if you are using hotmail ten please check your bulk folders for any reply ' kinda message

ranjan
05-10-2008, 07:05 AM
if the html looks like this:


<input id="email" type="text"><span id="msg"></span>


the following javascript would work


window.onload = function() { //when the document loads

var $ = function (el) { //create a function to return an element by id

return document.getElementById(el); // return the element

}

$('email').onblur = function() { //when email field loses focus

var emailAddress = $('email').value; // get whan the user typed in

var emailProvider = emailAddress.split("@"); // split input

var emailProvider = emailProvider[1]; // get domain

if(emailProvider == 'hotmail.com' || emailProvider == 'msn.com' || emailProvider == 'live.com') {

$('msg').innerHTML = 'Put your message here'; // if hotmail or msn or live then alert the user

}

}

}