Dreamweaver Club Forums

Dreamweaver Club Forums (http://www.dreamweaverclub.com/forum//index.php)
-   Javascript and JS frameworks (http://www.dreamweaverclub.com/forum//forumdisplay.php?f=186)
-   -   hotmail alert (http://www.dreamweaverclub.com/forum//showthread.php?t=27889)

edbr 05-10-2008 02:03 AM

hotmail alert
 
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:

Code:

<input id="email" type="text"><span id="msg"></span>
the following javascript would work

Code:

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

    }

  }

}



All times are GMT. The time now is 07:13 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com