<html>
<head>
<script language="javascript">
function verifyAddress(obj)
{
// obtain form value into variable
var email = obj.value;
alert ('email' + email);
// define regex
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

// test for pattern
flag = pattern.test(email);

if(flag)
{
alert("Right e-mail format!");
return true;
}
else
{
alert("Wrong e-mail format!");
return false;
}
}

</script>

</head>

<body>

<form>

<input name="mail" type="text" onBlur="return verifyAddress(this);">

<input type="submit">

</form>

</body>
</html>

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kingjoy1235 的頭像
    kingjoy1235

    King的幸福國度

    kingjoy1235 發表在 痞客邦 留言(0) 人氣()