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 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    15
    Thanks
    3
    Thanked 0 Times in 0 Posts

    call a function from jsp

    I am new to JSP

    I have implemented 4 radio buttons,
    when user clicks on a radio button , it should automatically a function in .js

    <input type="radio" name= "publication" value= "value1" id="1234" onclick="myfunction('this.value')">r1<input type="radio" name= "publication" value= "value2">r2<input type="radio" name= "publication" value= "vaue3">r3<input type="radio" name="publication" value="r4">r4

    I have this function in .js

    function myfunction(siteid)

    when I clcik on radio button r1 , the function is not getting called
    help me
    Thanks in advance
    bye
    Javaguy

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,208
    Thanks
    75
    Thanked 4,343 Times in 4,309 Posts
    Nothing to do with JSP...this is pure JavaScript. So you are new to both JSP and JavaScript, apparently??

    Wrong code:

    onclick="myfunction('this.value')"

    Right code:

    onclick="myfunction(this.value)"

    Having said that... The function should still have been called. It just would have been called with junk, not what you were expecting.

  • Users who have thanked Old Pedant for this post:

    javaguy1007 (03-19-2009)


  •  

    Posting Permissions

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