Using textbox text in javascript

Posted by Jambo on Stack Overflow See other posts from Stack Overflow or by Jambo
Published on 2012-06-11T08:56:09Z Indexed on 2012/06/11 10:40 UTC
Read the original article Hit count: 247

Filed under:
|
|
|
|

I am working with Twitter widgets with the following script-

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="button" value="Run Function" onclick="test();" />   
<script>

function test() {

    new TWTR.Widget({
        version: 3,
        type: 'profile',
        rpp: 8,
        interval: 30000,
        width: 315,
        height: 340,
        theme: {

            shell: {
                background: '#333333',
                color: '#ffffff'


            },
            tweets: {
                background: '#000000',
                color: '#ffffff',
                links: '#4aed05'

            }
        },
        features: {
            scrollbar: false,
            loop: false,
            live: false,
            behavior: 'all'

        }
    }).render().setUser(document.getElementById('TextBox1').value).start();
}

When using the function test(); in the button click it is ocming up with the error -

Error: Unable to get value of the property 'value': object is null or undefined

So it seems like it is not getting to the value at -

(document.getElementById('TextBox1').value)

I am not sure why it is null if the text box has a value and then the script is run on the button click?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about ASP.NET