Here is a sample code for validating email address using JavaScript regular expression.
var Email = "username@domain.com";
var flag = /^[a-zA-Z0-9_.]+@[a-zA-Z0-9]+[.][a-zA-Z]+[a-zA-Z.]*$/.test(Email);
if(flag){
alert('Valid email address');
}else
alert('Invalid email address');
This wiki-webreference blog provides scripts, tips and various best reference site URLs and links to get tutorials and scripts for IT developers (DHTML, JavaScript, Ajax, Xajax, PHP and MySql and etc) and other valuable information. And also this blog provides guidelines to Facebook application developers to develop Facebook application in PHP.
Sunday, December 23, 2007
Saturday, December 1, 2007
Find Position
Each html elements in a page has position values (ie. where the elements currentlyThe script follows. Argument of the function is the object of the HTML element,
placed). Basically it is measured by pixels from top and pixels from left.The top
and left position values are obtained by using the html elements attributs offsetTop
and offsetLeft.This can be calculated at run time using javascrit.
and it returns the array of values.
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
curleft = obj.offsetLeft
curtop = obj.offsetTop
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
}
return [curleft,curtop];
}
Subscribe to:
Posts (Atom)