Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. javascript doesn't work with FORM tag

javascript doesn't work with FORM tag

Scheduled Pinned Locked Moved JavaScript
helpquestionjavascript
10 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    williamroma
    wrote on last edited by
    #1

    (SORRY FOR MY BAD ENGLISH) hi i have a code , the javascript in the code is working perfectly , but when i surround the code with

    javascript stopped working , i tried to remove that

    then javascript continue working , please help me how can i solve this problem ? the code is

            *                   Name
                    
                
            *                   
    
                        Places
                        
                        Select
                            Roma
                            italy
                            totti
                        
                    
    
                
            *
    
    L Z 2 Replies Last reply
    0
    • W williamroma

      (SORRY FOR MY BAD ENGLISH) hi i have a code , the javascript in the code is working perfectly , but when i surround the code with

      javascript stopped working , i tried to remove that

      then javascript continue working , please help me how can i solve this problem ? the code is

              *                   Name
                      
                  
              *                   
      
                          Places
                          
                          Select
                              Roma
                              italy
                              totti
                          
                      
      
                  
              *
      
      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      williamroma wrote:

      when i surround the code with <form> </form> javascript stopped working , i tried to remove that <FORM> then javascript continue working ,
      please help me how can i solve this problem ?

      What problem, and where is the Javascript?

      Binding 100,000 items to a list box can be just silly regardless of what pattern you are following. Jeremy Likness

      1 Reply Last reply
      0
      • W williamroma

        (SORRY FOR MY BAD ENGLISH) hi i have a code , the javascript in the code is working perfectly , but when i surround the code with

        javascript stopped working , i tried to remove that

        then javascript continue working , please help me how can i solve this problem ? the code is

                *                   Name
                        
                    
                *                   
        
                            Places
                            
                            Select
                                Roma
                                italy
                                totti
                            
                        
        
                    
                *
        
        Z Offline
        Z Offline
        ZurdoDev
        wrote on last edited by
        #3

        JavaScript goes in the head tag and not in the form tag.

        There are only 10 types of people in the world, those who understand binary and those who don't.

        P 1 Reply Last reply
        0
        • Z ZurdoDev

          JavaScript goes in the head tag and not in the form tag.

          There are only 10 types of people in the world, those who understand binary and those who don't.

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          ryanb31 wrote:

          JavaScript goes in the head tag and not in the form tag.

          Not true! Try this in your favourite browser:

          <html>
          <body>
          <form>
          <script type="text/javascript">
          document.write("Hello World!");
          alert("Told ya!");
          </script>
          </form>
          </body>
          </html>

          Putting it in head might be good style, but it's not for function. Cheers, Peter

          Software rusts. Simon Stephenson, ca 1994.

          Z W 3 Replies Last reply
          0
          • P Peter_in_2780

            ryanb31 wrote:

            JavaScript goes in the head tag and not in the form tag.

            Not true! Try this in your favourite browser:

            <html>
            <body>
            <form>
            <script type="text/javascript">
            document.write("Hello World!");
            alert("Told ya!");
            </script>
            </form>
            </body>
            </html>

            Putting it in head might be good style, but it's not for function. Cheers, Peter

            Software rusts. Simon Stephenson, ca 1994.

            Z Offline
            Z Offline
            ZurdoDev
            wrote on last edited by
            #5

            True. However the OP said it does not work when put into the Form tag, so put it into the head tag.

            There are only 10 types of people in the world, those who understand binary and those who don't.

            1 Reply Last reply
            0
            • P Peter_in_2780

              ryanb31 wrote:

              JavaScript goes in the head tag and not in the form tag.

              Not true! Try this in your favourite browser:

              <html>
              <body>
              <form>
              <script type="text/javascript">
              document.write("Hello World!");
              alert("Told ya!");
              </script>
              </form>
              </body>
              </html>

              Putting it in head might be good style, but it's not for function. Cheers, Peter

              Software rusts. Simon Stephenson, ca 1994.

              W Offline
              W Offline
              williamroma
              wrote on last edited by
              #6

              thanks for your replay i don't mean that javascript doesn't work with me no it words but if i call any javascript function into a form tag , this doesn't work i will explay this works

              P B 2 Replies Last reply
              0
              • P Peter_in_2780

                ryanb31 wrote:

                JavaScript goes in the head tag and not in the form tag.

                Not true! Try this in your favourite browser:

                <html>
                <body>
                <form>
                <script type="text/javascript">
                document.write("Hello World!");
                alert("Told ya!");
                </script>
                </form>
                </body>
                </html>

                Putting it in head might be good style, but it's not for function. Cheers, Peter

                Software rusts. Simon Stephenson, ca 1994.

                W Offline
                W Offline
                williamroma
                wrote on last edited by
                #7

                and i don't want to put the javascipt in the same file with html , cos i have many many functions :(

                P 1 Reply Last reply
                0
                • W williamroma

                  thanks for your replay i don't mean that javascript doesn't work with me no it words but if i call any javascript function into a form tag , this doesn't work i will explay this works

                  P Offline
                  P Offline
                  Peter_in_2780
                  wrote on last edited by
                  #8

                  There must be something else wrong. Buttons with javascript actions work just fine in forms. Peter

                  Software rusts. Simon Stephenson, ca 1994.

                  1 Reply Last reply
                  0
                  • W williamroma

                    and i don't want to put the javascipt in the same file with html , cos i have many many functions :(

                    P Offline
                    P Offline
                    Peter_in_2780
                    wrote on last edited by
                    #9

                    In your html file, you can always write

                    <script type="text/javascript" src="myurl/myscript.js"></script>

                    That keeps your script in a separate file for ease of maintenance and reuse. Peter

                    Software rusts. Simon Stephenson, ca 1994.

                    1 Reply Last reply
                    0
                    • W williamroma

                      thanks for your replay i don't mean that javascript doesn't work with me no it words but if i call any javascript function into a form tag , this doesn't work i will explay this works

                      B Offline
                      B Offline
                      BobJanova
                      wrote on last edited by
                      #10

                      You are missing a quuote in your onclick there. Javascript definitely works on form controls so you're doing something else wrong.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups