submit to a page that only has javascript

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Matt

    #1

    submit to a page that only has javascript

    When the user submit the form in myform.jsp, it will submit to myaction.jsp. I
    want it only pop up test message box without having the browser with myaction.jsp,
    which is a blank page. Any ideas??

    myform.jsp
    ==========
    <FORM NAME="InputForm " ACTION="myactio n.jsp" METHOD="POST">
    //html controls
    </FORM>

    myaction.jsp
    ==========
    <script type="text/javascript">
    alert('test');
    </script>
  • Thomas Hoheneder

    #2
    Re: submit to a page that only has javascript

    Hello,

    as far as I know it is not possible to call a javascript function in a new
    page without having a blank window in the background.
    I think you will need something like that.

    myform.jsp
    ==========
    <HEAD>
    <script type="text/javascript">
    function func() {
    alert('test');
    }
    </script>
    </HEAD>
    <FORM NAME="InputForm " ACTION="javascr ipt:func()" METHOD="POST">
    //html controls
    </FORM>

    myaction.jsp -> is no longer needed
    ==========

    The goal is to change the action parameter of the form tag. There you must
    call a javascript function instead of opening a new jsp page. In that
    function func() you can call thatever javascript code you like. The
    javascript block with the function func() must pe placed in the <head> area
    of myform.jsp. Your second file myaction.jsp is no longer needed.

    Hope this helps you.

    Nice greetings from
    Thomas


    Comment

    Working...