CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2001
    Posts
    1

    javascript question

    Why won't the 3 links at the top of the page submit this form? Thanks in advance.


    <%

    session("action&quot = request("action&quot

    response.write(session("action&quot)

    %>


    <script language = "jscript">

    var SubmitTracker = "<%=session("action&quot%>";

    </script>


    <table width="43%" border="0" bgcolor="#FFFFFF"
    cellpadding="0" cellspacing="0">

    <tr>

    <td width="33%">

    <div align="center"><a href="JavaScript:handleForm(SubmitTracker,
    1);">1</a></div>

    </td>

    <td width="34%">

    <div align="center"><a href="JavaScript:handleForm(SubmitTracker,
    2);">2</a></div>

    </td>

    <td width="33%">

    <div align="center"><a href="JavaScript:handleForm(SubmitTracker,
    3);">3</a></div>

    </td>

    </tr>

    </table>


    <script language = "jscript">


    function handleForm(Loader, NextPage) {

    window.alert(Loader)

    window.alert(NextPage)


    switch (NextPage) {


    case 1 : document.Page1.action.value="1"

    break;

    case 2 : document.Page1.action.value="2"

    break;

    case 3 :

    document.Page1.action.value="3"

    break;

    }//end switch NextPage


    switch (Loader) {


    case 1 : document.Page1.submit();

    break;

    case 2 : document.Page1.submit();

    break;

    case 3 : document.Page1.submit();

    break;


    } //end switch Loader


    }

    </script>


    <form method="post" name="Page1" action="tester.asp">

    <input type="hidden" name="action" value=<%=action%>>

    <input type="submit" value="submit">

    </form>





  2. #2
    Join Date
    Apr 2001
    Location
    France
    Posts
    1

    Re: javascript question

    Your SubmitTracker is empty on the page first access so the switch (Loader) find no compatible case and do nothing, so first initiate your SubmitTracker variable or use the default : option in the switch ...


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured