javascript: function is not defined? - databinding
<p>i wonder why my code says that it's <em>not defined</em> when i'm trying to do a simple code with data binding :/</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;object name="login" id="login" classid="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83"&gt;
    &lt;param name="DataURL" value="member.txt"/&gt;
    &lt;param name="UseHeader" value="true"/&gt;
    &lt;param name="TextQualifier" value=""/&gt;
    &lt;param name="FieldDelim" value="|"/&gt;
&lt;/object&gt;

    &lt;script&gt;
        var rs = login.resultset;
        function validation()
        {
            rs.moveFirst();
            while(rs.moveNext())
            {           
                if(document.getElementById("txtid")== rs(0) &amp;&amp; document.getElementById("txtpass")==rs(1))
                {
                    alert("Login Succeed");
                    return; 
                }
            }
            alert("Email or Password Wrong");
            return;
        }
    &lt;/script&gt;

&lt;/head&gt;


&lt;body&gt;
&lt;form&gt;
Username: &lt;input type="text" id="txtid" /&gt; &lt;br/&gt;
Password: &lt;input type="text" id="txtpass" /&gt;&lt;br/&gt;
&lt;input type="submit" value="game start" id="btnstart" onclick="validation()"/&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>the error: <code>login is not defined</code></p>

<p>but i know that it's defined ! i have tried to search about this but i got no clue about what's wrong in my code :/
help please? </p>

<p><br/><br/>
<strong>EDIT:</strong>
i've updated my code to something like this:</p>

<pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;


&lt;body&gt;


&lt;form&gt;
Username: &lt;input type="text" id="txtid" /&gt; &lt;br/&gt;
Password: &lt;input type="text" id="txtpass" /&gt;&lt;br/&gt;
&lt;input type="submit" value="game start" id="btnstart" onclick="validation()"/&gt;
&lt;/form&gt;



&lt;object name="login" id="login" classid="CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83"&gt;
        &lt;param name="DataURL" value="member.txt"/&gt;
        &lt;param name="UseHeader" value="true"/&gt;
        &lt;param name="TextQualifier" value=""/&gt;
        &lt;param name="FieldDelim" value="|"/&gt;
&lt;/object&gt;

&lt;script&gt;
    var login = document.getElementById('login');
    var rs = login.resultset;
    function validation()
    {
        rs.moveFirst();
        while(rs.moveNext())
        {           
            if(document.getElementById("txtid")== rs(0) &amp;&amp; document.getElementById("txtpass")==rs(1))
            {
                alert("Login Succeed");
                return; 
            }
        }
        alert("Email or Password Wrong");
        return;
    }
&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>the next error i got is the <code>rs is undefined</code> when i'm clicking the button. am i doing something wrong?</p>
