User:Sanyam203/sandbox

-- For Displaying data through javascript in html page -- function displaydata {     var chkbox=document.getElementById("<%=Rdbutton1.ClientID%>"); var chkbox1=document.getElementById("<%=Rdbutton2.ClientID%>"); var chkbox2=document.getElementById("<%=Rdbutton3.ClientID%>") document.getElementById("<%=Txtmsg.ClientID%>").value=''; if(chkbox.checked) {       div1.style.display="block"; div3.style.display="block"; div2.style.display="none"; div4.style.display="block"; //div5.style.display="none"; }       if(chkbox1.checked) {       div1.style.display="none"; div3.style.display="block"; div2.style.display="block"; div4.style.display="block"; // div5.style.display="none"; }       if(chkbox2.checked) {       div1.style.display="none"; div3.style.display="none"; div2.style.display="block"; div4.style.display="block"; // div5.style.display="none"; }   } -- -- For validating numeric check only numeric keys will be pressed -- function validateNumeric(thi) {                 if (((event.keyCode < 48) || (event.keyCode > 57)) && (event.keyCode != 46)) event.returnValue = false; if(event.keyCode == 46) {                    if(thi.value.indexOf(".")==-1) event.returnValue = true; else event.returnValue = false; }              return true; } --- --- For checking length --- if(document.getElementById("<%=Textboxid.ClientID%>").value.length != 12) {                           alert("Mobile.No must be of 12 digits"); // document.getElementById("<%=Textboxid.ClientID%>").select; document.getElementById("<%=Textboxid.ClientID%>").focus; return false; }                       else {                           return true; } --- --- For checking file extension in fileupload control --- function checkFileExtensionLogo(elem,obj) {               var filePath = elem.value; if(filePath.indexOf('.') == -1) return false; var validExtensions = new Array; var ext = filePath.substring(filePath.lastIndexOf('.') + 1).toLowerCase; validExtensions[0] = 'csv'; for(var i = 0; i < validExtensions.length; i++) {                if(ext == validExtensions[i]) return true; }           alert('Invalid file, only csv files are allowed.'); var who=document.getElementsByName(obj)[0]; who.value="";var who2= who.cloneNode(false); who2.onchange= who.onchange; who.parentNode.replaceChild(who2,who); return false; } --- --- For count of SMS --- function countMe(txtmsg) {          // debugger; var count=0; var msgLen=0;

// var len= document.getElementById("<%=Txtmsg.ClientID%>").length; var len=txtmsg.value.length; var setValue=count+len; if(setValue<=160) {           msgLen=1; //alert('in function' +   setValue); document.getElementById("<%=label4.ClientID%>").innerHTML="Total characters"+ setValue+ "   No of SMS:" +msgLen; }           else {           var roundMsg=setValue/160; msgLen=Math.ceil(roundMsg); document.getElementById("<%=label4.ClientID%>").innerHTML="Total characters"+ setValue+ "  No of SMS:" +msgLen; }        return true; } --- ---