Tuesday, November 26, 2013

Some Java Script Code Isfloat Isnumeric

     function IsNumeric1(VALUE) {
            for (var ivA = 0; ivA < VALUE.length; ivA++) {
                if (VALUE.charCodeAt(ivA) < 48 || VALUE.charCodeAt(ivA) > 57) {
                    if (VALUE.charCodeAt(ivA) != 46 && VALUE.charCodeAt(ivA) != 32 && VALUE.charAt(ivA) != ",") {
                        return false;
                    }
                }
            }
            if (VALUE.split(".").length > 2) {
                return false;
            }
            return true;
        }

        function isFloat(argvalue) {
            var count, temp;
            var n;
            count = 0;
            argvalue = argvalue.toString();
            if (argvalue.length == 0)
                return false;
            for (n = 0; n < argvalue.length; n++) {
                if (Instr1(n, argvalue, '.') > 1 && argvalue.charAt(n) == ".") {
                    count = count + 1;
                    if (count > 1) {
                        return false;
                    }
                }
            }
            for (n = 0; n < argvalue.length; n++) {
                if (argvalue.substring(n, n + 1) < "0" || argvalue.substring(n, n + 1) > "9") {
                    if (argvalue.substring(n, n + 1) == ".") {
                    }
                    else {
                        return false;
                    }
                }
            }
            return true;
        }
        function Instr1(Start, targetstr, character) {
            var i;
            var ch;
            for (i = Start - 1; i <= targetstr.length; ++i) {
                ch = targetstr.charAt(i);
                if (ch == character) {
                    return i + 1;
                    break;
                }
            }


        }
        function trim(myString) {
            return myString.replace(/^s+/g, '').replace(/s+$/g, '')
        }
function ViewDate(strControl, lpos, tpos) {
            var cal1 = new calendar1(Form1.item(strControl));
            cal1.year_scroll = true;
            cal1.time_comp = false;
            cal1.CustomSeprator = "/";
            cal1.CustomFormat = "dd/mm/yyyy";
            cal1.Win_LeftPos = lpos;
            cal1.Win_TopPos = tpos;
            cal1.popup();
        }


        function daysInMonth(month, year) {
            return new Date(year, month, 0).getDate();
        }


        function SaveRecord(IntID, txt, rowid) {

            if (trim(document.getElementById(txt).value) != "") {

                var checkid = parseInt(document.getElementById(txt).value);
                //checkid = checkid + 1;
                //alert(rowid);
                var k;

                for (var i = parseInt(rowid); i < parseInt(document.getElementById('<%= hdRows.ClientID%>').value) + 2; i++) {
                    //  alert(i);
                    if (i.toString().length < 2) {
                        k = '0' + i;
                        // k = i;
                        //alert(k);
                    }
                    else {
                        k = i;

                    }
                    document.getElementById('ctl00_MainContentPlaceHolder_dgInterest_ctl' + k + '_txtChequeNo').value = checkid;
                    checkid = checkid + 1;
                    // document.getElementById('<%= Hdstring.ClientID%>').value = document.getElementById('<%= Hdstring.ClientID%>').value + trim(IntID) + "^";
                }

                document.getElementById('<%= Hdstring.ClientID%>').value = document.getElementById('<%= Hdstring.ClientID%>').value + trim(IntID) + "^";
                // alert(document.getElementById('<%= Hdstring.ClientID%>').value);
            }

        }


        function SaveRecordNew(txt, rowid) {

            alert('rowid' + rowid);
            alert(parseInt(txt.value) + 2);


            if (trim(document.getElementById(txt).value) != "") {

                var checkid = parseInt(document.getElementById(txt).value);
                //checkid = checkid + 1;
                //alert(rowid);
                var k;

                for (var i = parseInt(rowid); i < parseInt(document.getElementById('<%= hdRows.ClientID%>').value) + 2; i++) {
                    //  alert(i);
                    if (i.toString().length < 2) {
                        k = '0' + i;
                        // k = i;
                        //alert(k);
                    }
                    else {
                        k = i;

                    }
                    alert(k);
                    //ctl00_MainContentPlaceHolder_dgInterest_ctl02_txtChequeN
                    document.getElementById('ctl00_MainContentPlaceHolder_dgInterest_ctl' + k + '_txtChequeNo').value = checkid;
                    checkid = checkid + 1;
                    // document.getElementById('<%= Hdstring.ClientID%>').value = document.getElementById('<%= Hdstring.ClientID%>').value + trim(IntID) + "^";
                }

                document.getElementById('<%= Hdstring.ClientID%>').value = document.getElementById('<%= Hdstring.ClientID%>').value + trim(IntID) + "^";
                // alert(document.getElementById('<%= Hdstring.ClientID%>').value);
            }

        }


   

No comments:

Post a Comment