View Full Version : Other YUI Event.addListener

10-07-2009, 09:50 PM
I just started learning YUI, to practice I put together the code below. How can I pass a specific argument - the "email" variable - to the handler?


function validate_email(obj){
var email_exp = new RegExp(/^[\w\.\-]+@([\w\-]+\.)+[a-zA-Z]+$/);
if (!email_exp.test(email.value){
alert("Invalid Email Address");

function init(){
var email = YAHOO.util.Dom.get("email");
YAHOO.util.Event.addListener(email, "blur", validate_email);

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum