need some newbie help...

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • trfilmographer@gmail.com

    need some newbie help...

    Hi fellow web developers!

    I have a little problem due to my lack of javascript / web developing
    skills...

    Basically I have a form embedded in a table. WHat I would like to do,
    is have the form be submitted when I click on a href link. Currently
    it appears that the page reloads - but nothing actually is submitted.

    here is a demo code,,, is it something in the head?

    <html>
    <head>
    <SCRIPT language="JavaS cript">
    function submitCode()
    {
    document.ApplyC ode.submit();
    }
    </SCRIPT>
    </head>
    <body>

    <table>
    <tr>
    <td>
    <form action="thisPag e.jsp" name="SubmitCod e"
    method="post">
    Code:
    <input type="text" name="Code" />
    <!-- this is the line that doesnt work right -->
    <a href="thisPage. jsp"
    onClick="javasc ript: submitCode()">
    Click Me
    </a>
    </form>
    </td>
    </tr>
    </table>

    </body>
    </html>
  • trfilmographer@gmail.com

    #2
    Re: need some newbie help...

    On Sep 25, 1:51 am, trfilmograp...@ gmail.com wrote:
    Hi fellow web developers!
    >
    I have a little problem due to my lack ofjavascript/ web developing
    skills...
    >
    Basically I have a form embedded in a table.  WHat I would like to do,
    is have the form be submitted when I click on a href link.  Currently
    it appears that the page reloads - but nothing actually is submitted.
    >
    here is a demo code,,, is it something in the head?
    >
    <html>
    <head>
    <SCRIPT language="JavaS cript">
            function submitCode()
            {
              document.Submit Code.submit();
            }
    </SCRIPT>
    </head>
    <body>
    >
    <table>
      <tr>
         <td>
               <form action="thisPag e.jsp" name="SubmitCod e"
    method="post">
                            Code:
                            <input type="text" name="Code" />
                         <!-- this is the line that doesnt work right -->
                                                    <a href="thisPage. jsp"
    onClick="javasc ript: submitCode()">
                                Click Me
                              </a>
                    </form>
        </td>
     </tr>
    </table>
    >
    </body>
    </html>
    oops - Just so you know, there is still an issue, but the demo above
    mis-named the form in the javascript... still need some guidance..

    Comment

    • SAM

      #3
      Re: need some newbie help...

      Le 9/25/08 8:16 AM, trfilmographer@ gmail.com a écrit :
      On Sep 25, 1:51 am, trfilmograp...@ gmail.com wrote:
      >Hi fellow web developers!
      >
      oops - Just so you know, there is still an issue, but the demo above
      mis-named the form in the javascript... still need some guidance..
      You must stop the HTML link
      (with return false;)

      E.G. :

      <a href="page.htm"
      onclick="alert( this.href); return false;">href</a>


      page's code :
      -------------

      <html>
      <head>
      <script type="text/javascript">
      function submitCode()
      {
      document.Submit Code.submit();
      return false;
      }
      </script>
      </head>
      <body>
      <table>
      <tr>
      <td>
      <form action="thisPag e.jsp" name="SubmitCod e"
      method="post">
      Code:
      <input type="text" name="Code" />
      <!-- this is the line that doesnt work right -->
      <a href="thisPage. jsp"
      onclick="return submitCode()">
      Click Me
      </a>
      </form>
      </td>
      </tr>
      </table>
      </body>

      Comment

      • Thomas 'PointedEars' Lahn

        #4
        Re: need some newbie help...

        trfilmographer@ gmail.com wrote:
        On Sep 25, 1:51 am, trfilmograp...@ gmail.com wrote:
        >I have a little problem due to my lack ofjavascript/ web developing
        >skills...
        >[...]
        >here is a demo code,,, is it something in the head?
        >>
        >[junk removed]
        >
        oops - Just so you know, there is still an issue, but the demo above
        mis-named the form in the javascript... still need some guidance..
        You should learn HTML before you make an attempt at Web programming.

        <http://validator.w3.or g/>


        PointedEars
        --
        Anyone who slaps a 'this page is best viewed with Browser X' label on
        a Web page appears to be yearning for the bad old days, before the Web,
        when you had very little chance of reading a document written on another
        computer, another word processor, or another network. -- Tim Berners-Lee

        Comment

        Working...