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. Other Discussions
  3. Clever Code
  4. Subtle Javascript Bug

Subtle Javascript Bug

Scheduled Pinned Locked Moved Clever Code
javascripthelpquestion
10 Posts 7 Posters 9 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.
  • R Offline
    R Offline
    Reelix
    wrote on last edited by
    #1

    This is the onclick event of a button on a form - Took awhile to figure out what was wrong ;P The checkform() function is irrelevant to the question.

    onclick=" if ((document.getElementById('whereto').value) = 'rent') { void(document.getElementById('toRent').value='1'); } else { void(document.getElementById('toRent').value='0'); } checkform()"

    -= Reelix =-

    M M 2 Replies Last reply
    0
    • R Reelix

      This is the onclick event of a button on a form - Took awhile to figure out what was wrong ;P The checkform() function is irrelevant to the question.

      onclick=" if ((document.getElementById('whereto').value) = 'rent') { void(document.getElementById('toRent').value='1'); } else { void(document.getElementById('toRent').value='0'); } checkform()"

      -= Reelix =-

      M Offline
      M Offline
      Mike Holpuch
      wrote on last edited by
      #2

      Should it be if ((document.getElementById('whereto').value) == 'rent')?

      R 1 Reply Last reply
      0
      • M Mike Holpuch

        Should it be if ((document.getElementById('whereto').value) == 'rent')?

        R Offline
        R Offline
        Reelix
        wrote on last edited by
        #3

        Correct :) I was wondering why the value was never altered - Spent about 30 minutes searching through the "checkform()" procedure (around 200 LoC) - Scrutinizing every line - Double and triple checking to see if maybe, just maybe I had done something wrong... /facepalm

        -= Reelix =-

        K 1 Reply Last reply
        0
        • R Reelix

          This is the onclick event of a button on a form - Took awhile to figure out what was wrong ;P The checkform() function is irrelevant to the question.

          onclick=" if ((document.getElementById('whereto').value) = 'rent') { void(document.getElementById('toRent').value='1'); } else { void(document.getElementById('toRent').value='0'); } checkform()"

          -= Reelix =-

          M Offline
          M Offline
          MidwestLimey
          wrote on last edited by
          #4

          Which is why I tend to write it thus: 'rent' == (document.getElementById('whereto').value) Makes mistakes much more obvious.

          10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

          R J 2 Replies Last reply
          0
          • M MidwestLimey

            Which is why I tend to write it thus: 'rent' == (document.getElementById('whereto').value) Makes mistakes much more obvious.

            10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

            R Offline
            R Offline
            Reelix
            wrote on last edited by
            #5

            Hmm - Will try that in the future :) On a side note, are you aware your signature translates to:

            ³>ª4¢ ��<X²

            :)

            -= Reelix =-

            M P 2 Replies Last reply
            0
            • R Reelix

              Hmm - Will try that in the future :) On a side note, are you aware your signature translates to:

              ³>ª4¢ ��<X²

              :)

              -= Reelix =-

              M Offline
              M Offline
              MidwestLimey
              wrote on last edited by
              #6

              Sure doesn't. There's a message in there.

              10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

              L 1 Reply Last reply
              0
              • M MidwestLimey

                Sure doesn't. There's a message in there.

                10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                Oh? Are we decoding binary now? It says: YOU ARE A GEEK (yay me!)

                1 Reply Last reply
                0
                • R Reelix

                  Hmm - Will try that in the future :) On a side note, are you aware your signature translates to:

                  ³>ª4¢ ��<X²

                  :)

                  -= Reelix =-

                  P Offline
                  P Offline
                  Paulo Zemek
                  wrote on last edited by
                  #8

                  Found the same string.

                  1 Reply Last reply
                  0
                  • R Reelix

                    Correct :) I was wondering why the value was never altered - Spent about 30 minutes searching through the "checkform()" procedure (around 200 LoC) - Scrutinizing every line - Double and triple checking to see if maybe, just maybe I had done something wrong... /facepalm

                    -= Reelix =-

                    K Offline
                    K Offline
                    killabyte
                    wrote on last edited by
                    #9

                    dont u hate these problems, u stare at it for so long and over analyse everything around it until u ask a fellow engineer then facepalm when he/she spots typo in 5 seconds. this problem is usually caused by caffine deficiency of the brain. :cool:

                    1 Reply Last reply
                    0
                    • M MidwestLimey

                      Which is why I tend to write it thus: 'rent' == (document.getElementById('whereto').value) Makes mistakes much more obvious.

                      10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011

                      J Offline
                      J Offline
                      John Y
                      wrote on last edited by
                      #10

                      omg, that is a very clever habit to get into! I love it - and am almost ashamed I haven't though to do that...that little typeo gets me every now and then

                      ________ John Y. Developer

                      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