Users Pricing

forum

Home Forums Javascript Object Required using JavaScript and C# – MindStick

Javascript Object Required using JavaScript and C#

E E Cummings 2756 14 Oct 2013

I am checking the email Id of the user during registration to it is valid or not I am using the Javascript.I am getting the value of the Textbox in the function during button click and verifying it but during click of the button it shows Microsoft JScript runtime error: Object required error Can any one point out what would be wrong in my code,

My javascript Function is,

     var txt = document.getElementById("emailid").value;
    if (txt != "") {
        var at = "@"
        var dot = "."
        var lat = str.indexOf(at)
        var lstr = str.length
        var ldot = str.indexOf(dot)
        if (txt.indexOf(at) == -1) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (txt.indexOf(at) == -1 || txt.indexOf(at) == 0 || txt.indexOf(at) == ltxt) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (txt.indexOf(dot) == -1 || txt.indexOf(dot) == 0 || txt.indexOf(dot) == lstr) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (str.indexOf(at, (lat + 1)) != -1) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (txt.substring(lat - 1, lat) == dot || txt.substring(lat + 1, lat + 2) == dot) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (txt.indexOf(dot, (lat + 2)) == -1) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
        if (txt.indexOf(" ") != -1) {
            alert("Invalid E-mail ID")
            obj.focus()
            return false
        }
    }
    return true
}

1 Answers

Markdown for AI

A clean, structured version of this page for AI assistants and LLMs.

Open .md