troubleshooting Question

javascript can't "see" submit button...

Avatar of codefinger
codefingerFlag for United States of America asked on
JavaScriptWeb DevelopmentASP.NET
6 Comments3 Solutions431 ViewsLast Modified:
the javascript:
function hideForm() {

    var pfirstname;
    var plastname;
    var pemail;
    var chekbx;
    var subbutton;
    

    pfirstname = document.getElementById("pFirstName");
    plastname = document.getElementById("pLastName");
    pemail = document.getElementById("pEmail");
    chekbx = document.getElementById("CheckBox1");
    subbutton = document.getElementById("ButtonSubmit");


    pfirstname.style.display = "none";
    plastname.style.display = "none";
    pemail.style.display = "none";
    subbutton.style.display = "none";
    chekbx.style.display = "none";

}

some of the page:

<P align="left">
            <asp:CheckBox ID="CheckBox1" runat="server" Font-Bold="True" 
                Text="I have read and I agree to the terms of the confidentiality agreement." />
        </P>
        <P align="left">
            <asp:CustomValidator ID="CustomValidatorIsChecked" runat="server" 
                ClientValidationFunction="IsBoxChecked" 
                ErrorMessage="You must check this box to see the videos." ForeColor="#CC3300"></asp:CustomValidator>
        </P>
        <P align="center">
            <asp:Button ID="ButtonSubmit" runat="server" Text="Submit" />
        </P>
        <P>After you have viewed the videos, you can choose to:<BR clear="all"></P><UL><LI>Apply to become a beta tester and/or</LI><LI>Reserve a copy of VERA at a substantial discount.</LI>
        </UL>

the problem:
subbutton is always null...I cannot get a handle on it to hide it.  I thought at first it was because it is a server control, but the checkbox is also a server control and I have no trouble grabbing it in the code.

So what am I missing?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 3 Answers and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros