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. IE 8 hiddenfeild issue

IE 8 hiddenfeild issue

Scheduled Pinned Locked Moved Web Development
javascripthelp
7 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.
  • S Offline
    S Offline
    salmonraju
    wrote on last edited by
    #1

    Hi, Hi, Below code is working fine in IE6 my aspx page contains below tag <input type="hidden" name="HddElement" /> My javascript is accessing this element like below document.getElementById("HddElement").value = var1; But in IE8 i am getting exception at above line. if i achenged that to below it is working fine. document.all.HddElement=var1; Please let me why this is not working in IE8 with document.getElementById Thanks, Salmon

    D B N 3 Replies Last reply
    0
    • S salmonraju

      Hi, Hi, Below code is working fine in IE6 my aspx page contains below tag <input type="hidden" name="HddElement" /> My javascript is accessing this element like below document.getElementById("HddElement").value = var1; But in IE8 i am getting exception at above line. if i achenged that to below it is working fine. document.all.HddElement=var1; Please let me why this is not working in IE8 with document.getElementById Thanks, Salmon

      D Offline
      D Offline
      daveyerwin
      wrote on last edited by
      #2

      Here are two examples of how your code should look ... init = function() { var1="hello"; alert(document.getElementById("HddElement").value) document.getElementById("HddElement").value = var1; alert(document.getElementById("HddElement").value) } init = function() { var1="hello"; f = document.forms[0]; alert(f.HddElement.value) f.HddElement.value = var1; alert(f.HddElement.value) }

      N 1 Reply Last reply
      0
      • S salmonraju

        Hi, Hi, Below code is working fine in IE6 my aspx page contains below tag <input type="hidden" name="HddElement" /> My javascript is accessing this element like below document.getElementById("HddElement").value = var1; But in IE8 i am getting exception at above line. if i achenged that to below it is working fine. document.all.HddElement=var1; Please let me why this is not working in IE8 with document.getElementById Thanks, Salmon

        B Offline
        B Offline
        burntblark
        wrote on last edited by
        #3

        Well for starters your hidden element should look like this: <input type="hidden" name="HddElement" id="HddElement" />

        D 1 Reply Last reply
        0
        • B burntblark

          Well for starters your hidden element should look like this: <input type="hidden" name="HddElement" id="HddElement" />

          D Offline
          D Offline
          daveyerwin
          wrote on last edited by
          #4

          http://validator.w3.org/check">http://validator.w3.org/check this validates ... ValidationTest

          hi

          this gives warning ... ValidationTest

          hi

          here is the warning ... The sequence can be interpreted in at least two different ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict, the '/' terminates the tag '). However, since many browsers don't interpret it this way, even in the presence of an HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure HTML documents and reserve its use solely for those written in XHTML.

          N 1 Reply Last reply
          0
          • D daveyerwin

            http://validator.w3.org/check">http://validator.w3.org/check this validates ... ValidationTest

            hi

            this gives warning ... ValidationTest

            hi

            here is the warning ... The sequence can be interpreted in at least two different ways, depending on the DOCTYPE of the document. For HTML 4.01 Strict, the '/' terminates the tag '). However, since many browsers don't interpret it this way, even in the presence of an HTML 4.01 Strict DOCTYPE, it is best to avoid it completely in pure HTML documents and reserve its use solely for those written in XHTML.

            N Offline
            N Offline
            Not Active
            wrote on last edited by
            #5

            Please remember to format (using pre or code tags) any code you include in your post.


            I know the language. I've read a book. - _Madmatt

            1 Reply Last reply
            0
            • D daveyerwin

              Here are two examples of how your code should look ... init = function() { var1="hello"; alert(document.getElementById("HddElement").value) document.getElementById("HddElement").value = var1; alert(document.getElementById("HddElement").value) } init = function() { var1="hello"; f = document.forms[0]; alert(f.HddElement.value) f.HddElement.value = var1; alert(f.HddElement.value) }

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Please remember to format (using pre or code tags) any code you include in your posts.


              I know the language. I've read a book. - _Madmatt

              1 Reply Last reply
              0
              • S salmonraju

                Hi, Hi, Below code is working fine in IE6 my aspx page contains below tag <input type="hidden" name="HddElement" /> My javascript is accessing this element like below document.getElementById("HddElement").value = var1; But in IE8 i am getting exception at above line. if i achenged that to below it is working fine. document.all.HddElement=var1; Please let me why this is not working in IE8 with document.getElementById Thanks, Salmon

                N Offline
                N Offline
                Nick Kowalewicz
                wrote on last edited by
                #7

                Because, you are not supplying the "ID" in the element.

                Regards, Nick Kowalewicz Web: www.nk-inc.com

                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