Not getting a value for document.getElementById("txtOrganization").value;

daforga used Ask the Experts™
I have an aspx page that needs to open a popu widow for user input.  The routine is called from a button and the correct page is called using the code listed in the Code: box.  My problem is passing variable to the popup window.  There are several textboxes on the popup that need to be populated with the content of controls from the calling page.  My thought has been to do this via querystring like this:
        var orgName = document.getElementById("txtOrganization").value;
         var url = "AddContact.aspx?orgName=" + orgName
There is a value in the above mentioned textbox when the Button is clicked, but no value is passed to the variable in the JavaScript function.  
Can anyone help me with this problem?

<asp:Button ID = "btnAddContact" Text = "Add Contact" runat = "server" OnClientClick="Pop_Window();" />
<script type ="text/javascript" language="javascript">
    function pop_window()
       // I would like to get the below value and append it to the url
       //var str = document.getElementById("txtOrganization").value;
        var confirm = null;
       var url = "AddContact.aspx";
        confirmWin =''+ url + '','anycontent',

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2013
where is the textbox ?
 try this:
var str = document.getElementById('<%=txtOrganization.ClientID %>').value;


Excellent.  Thanks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial