45 pts.
 onBlur event to textbox in javascript
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
ASKED: December 31, 2010  6:27 AM
UPDATED: March 5, 2011  6:03 AM

Answer Wiki:
<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>
Last Wiki Answer Submitted:  March 5, 2011  6:02 am  by  MEHRA   145 pts.
All Answer Wiki Contributors:  MEHRA   145 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _