Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post

    onclick event handlers

    hi,
    i need to be able to take the values from two text boxes and change the location of a sprite on my canvas, i've searched the internet and it doesnt really explain how to do it for me. here is my code:

    x: <input type="text" name="x" id="x"/><br />
    y: <input type="text" name:"y" id="y"/><br />
    <input type="submit" value="Submit" onClick="ChangeCo()" /><br />

    function ChangeCo()
    {
    }

    and i need the function to take the x and y values from the text boxes and change the values of my variables:

    var block_x;
    var block_y;


    block_x = 290;
    block_y = 70;

    Thankyou in advance

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,918
    Thanks
    203
    Thanked 2,531 Times in 2,509 Posts

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    New Coder
    Join Date
    Mar 2012
    Posts
    14
    Thanks
    3
    Thanked 1 Time in 1 Post
    oh sorry, but my second one was more specific as the first one i didnt know i needed an onclick event handler, so i posted again to find out how they worked thats all

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,634
    Thanks
    6
    Thanked 1,002 Times in 975 Posts
    Quote Originally Posted by drew_uk View Post
    oh sorry, but my second one was more specific as the first one i didnt know i needed an onclick event handler, so i posted again to find out how they worked thats all
    You can just update/continue your current thread with the new question as it relates to the subject.

  • Users who have thanked VIPStephan for this post:

    drew_uk (03-01-2012)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •