Results 1 to 5 of 5
Thread: onclick event in jsp
- 06-28-2011, 07:15 PM #1
Member
- Join Date
- Jun 2011
- Posts
- 9
- Rep Power
- 0
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.
- 06-28-2011, 07:44 PM #2
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,619
- Rep Power
- 5
This is a javascript problem, not a java problem. You might have better luck posting on a javascript dedicated forum.
- 06-29-2011, 09:29 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
You haven't called submit() on the form.
You've just changed the action value.
- 06-30-2011, 06:06 AM #4
Member
- Join Date
- Jun 2011
- Posts
- 9
- Rep Power
- 0
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.
- 06-30-2011, 09:22 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,484
- Rep Power
- 16
Similar Threads
-
TableRow OnClick Listener
By sehudson in forum Advanced JavaReplies: 0Last Post: 05-26-2011, 02:48 AM -
help with onclick
By unplugged in forum Java AppletsReplies: 4Last Post: 12-15-2009, 12:24 AM -
Globally disable onclick
By karnesb in forum New To JavaReplies: 4Last Post: 10-13-2008, 03:45 AM -
use of onclick function
By m4tt in forum New To JavaReplies: 1Last Post: 02-16-2008, 03:03 AM -
JButton onClick?
By Joe2003 in forum AWT / SwingReplies: 2Last Post: 01-06-2008, 03:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks