Thank you dear Benson.
I tried it but it seems like the onpropertychange doesnt envoke my javascript function, this is the code:
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="EmailRegTxtB"
ErrorMessage="Your email is not a valid email!"
Font-Bold="True"
Font-Size="XX-Small"
ForeColor="IndianRed"
onpropertychange="validateCheckemail()"
Style="z-index: 160; left: 166px; position: absolute; top: 170px"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
</asp:RegularExpressionValidator>
and this is my javascript code:
function validateCheckemail()
{
var regularev = document.getElementById(prefix + 'RegularExpressionValidator1');
if (regularev.style.visibility == 'hidden')
{
document.getElementById(prefix + 'emaillbl').style.visibility = "visible";
document.getElementById(prefix + 'emaillbl').style.backgroundImage = "url('images/icons/correct.png')";
document.getElementById(prefix + 'TitleDropD').disabled = false;
document.getElementById(prefix + 'TitleDropD').focus();
}
else
{
document.getElementById(prefix + 'TitleDropD').disabled = true;
document.getElementById(prefix + 'emaillbl').style.visibility = "visible";
document.getElementById(prefix + 'emaillbl').style.backgroundImage = "url('images/icons/wrong.png')";
//document.getElementById(prefix + 'lblMsg5').innerHTML = 'Your email is not a valid email!';
}
}
the funny thing is that I used normal javascript regular expression validation using test() and everything was working fine apart from internet explorer. it was showing me stupid javascript error, something like object is not referenced or something. but with regular expression validator it doesnt show that error and that is why I want to use it.
Thanks