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
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    object name trouble

    if i have

    function newevent(val){
    alert(val);
    }

    <input type="button" value="Add a new event here" Onclick="newevent(abcd);">

    how can i get it to alert "abcd" instead of "[object]". I understand i am passing it as an object and i need to pass it this way as i use the object bit for something else. so how can i do it without replacing Onclick="newevent(abcd);" with Onclick="newevent('abcd');"


    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #2
    Regular Coder
    Join Date
    Jul 2003
    Location
    Massachusetts
    Posts
    472
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry, but I don't really understand what you're asking.
    Moderator @ WebDeveloper.com
    Mentor @ WebXpertz.net

  • #3
    Regular Coder
    Join Date
    Apr 2003
    Location
    Northern California
    Posts
    169
    Thanks
    0
    Thanked 0 Times in 0 Posts
    U need quotes try this

    function newevent(val){
    alert(val);
    }

    <input type="button" value="Add a new event here" Onclick="newevent('abcd');">

  • #4
    Red Devil Mod Kor's Avatar
    Join Date
    Apr 2003
    Location
    Bucharest, ROMANIA
    Posts
    8,478
    Thanks
    58
    Thanked 379 Times in 375 Posts
    Always quote parameters if string...
    KOR
    Offshore programming
    -*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*


  •  

    Posting Permissions

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