onBlur event to textbox in javascript

45 pts.
Tags:
C# .NET
Java
JavaScript
Scripting
TextBox
I have textboxes in grid ,if the value in that textbox other than p,A,HA,HL i want to give alert message i wrote the code but javascript is not fired

in the code i bind script on Rowdatabound of grid

 

<

 

 

script language="javascript" type="text/javascript">

 

 

function GetMessage(ctrlText) {  

 



var ctrl1 = document.getElementById(ctrlText);  

 



//alert('hi');

 

 

if (ctrl1.value != '') {  

 



if (ctrl1.value != 'P' || ctrl1.value != 'A' || ctrl1.value != 'L' || ctrl1.value != 'HL' || ctrl1.value != 'HA' || ctrl1.value != 'WO' || ctrl1.value != 'PH' || ctrl1.value != 'OS ' || ctrl1.value != 'CC' || ctrl1.value != 'CA') { alert(

 



'Only Enter value in Legends.'); }

}

}

 

 

 

 



</script>



txt2.Attributes.Add(

 

"onBlur", "javascript: return GetMessage('" + txt2.ClientID + "'"); txt3.Attributes.Add(

 



"onBlur", "javascript:GetMessage('" + txt3.ClientID + "'"); txt4.Attributes.Add(

 



"onBlur", "javascript:GetMessage('" + txt4.ClientID + "'"); txt5.Attributes.Add(

 



"onBlur", "javascript:GetMessage('" + txt5.ClientID + "'"); txt6.Attributes.Add(

 



"onBlur", "javascript:GetMessage('" + txt6.ClientID + "'"); txt7.Attributes.Add(

 



"onBlur", "javascript:GetMessage('" + txt7.ClientID + "'");



Software/Hardware used:
c#.net,Javascript

Answer Wiki

Thanks. We'll let you know when a new response is added.

<b>

Hi ,
Jyoti
what u can do is you just check your java script code in different browser some time java script work and some time it not work .</b>

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following