Results 1 to 5 of 5
  1. #1
    happy is offline Member
    Join Date
    Jun 2011
    Posts
    9
    Rep Power
    0

    Arrow onclick event in jsp

    <head>
    < script language="javascript">
    fun()
    {
    alert("entered");
    document.form1.action="test2.jsp";


    }
    </script>
    </head>
    <body>
    <form name="form1">
    <input type="button" name="next" value="next" onclick="fun();">
    </form>
    </body>

    On clicking the button the corresponding javascript code is called (alert"entered" is coming) but next page "test2.jsp" is not opening.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    7

    Default

    This is a javascript problem, not a java problem. You might have better luck posting on a javascript dedicated forum.

  3. #3
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default

    You haven't called submit() on the form.
    You've just changed the action value.

  4. #4
    happy is offline Member
    Join Date
    Jun 2011
    Posts
    9
    Rep Power
    0

    Default

    thanks for your reply ..

    @tolls:-
    but that button is not a submit button . its a normal button which on clicking just transfers to next page. so i have called the function fun() in its onclick event.
    its not according to the Document Object model.. i.e. document.form_name.action.
    the same code runs well in a normal html file but its not working when using in a servlet.

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default

    Can you show the code used in a normal html file?
    Because I doubt it's the same...

    That code above is simply settting the action value for a form.
    It will not change the page until that is submitted.

Similar Threads

  1. TableRow OnClick Listener
    By sehudson in forum Advanced Java
    Replies: 0
    Last Post: 05-26-2011, 02:48 AM
  2. help with onclick
    By unplugged in forum Java Applets
    Replies: 4
    Last Post: 12-15-2009, 12:24 AM
  3. Globally disable onclick
    By karnesb in forum New To Java
    Replies: 4
    Last Post: 10-13-2008, 03:45 AM
  4. use of onclick function
    By m4tt in forum New To Java
    Replies: 1
    Last Post: 02-16-2008, 03:03 AM
  5. JButton onClick?
    By Joe2003 in forum AWT / Swing
    Replies: 2
    Last Post: 01-06-2008, 03:04 PM

Posting Permissions

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