sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Document.getElementById ?

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 3 Posters 352 Views 3 Watching
    Loading More Posts
    • 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.
    • D Offline
      driven
      last edited by

      on a mac, both of these work...
      is that the same on other PC variants...

      d.execute_script %Q(document.getElementById('trans_L8').value='Translate';)
      
      d.execute_script %Q(trans_L8.value='Translate';)
      

      john

      learn from the mistakes of others, you may not live long enough to make them all yourself...

      1 Reply Last reply Reply Quote 0
      • A Offline
        Aerilius
        last edited by

        Well, it's something basic one expects from all browsers to work. Not a question of operating system.
        But I use document.getElementById a lot (or frameworks using it) and it works, in IE, even the old IE6.
        Whether you can use .value= depends on what type of element you access ( HTMLInputElement ?).

        1 Reply Last reply Reply Quote 0
        • D Offline
          driven
          last edited by

          the question is about the shorthand access inside a Webdialog, so WebKit v IE...

          I find it cleaner without document string element...

          and when generating dynamically the files smaller, so should be faster?

          so, to rephrase, can IE handle the shorthand for any attribute, value/name/title etc...

          john

          learn from the mistakes of others, you may not live long enough to make them all yourself...

          1 Reply Last reply Reply Quote 0
          • G Offline
            Gábor
            last edited by

            My quick test with Sketchup v2014, IE 11 shows that both forms work. Have no information about other versions.

            1 Reply Last reply Reply Quote 0
            • D Offline
              driven
              last edited by

              cheers Gábor,

              I have a lot of them and the shorter the better...

              john

              learn from the mistakes of others, you may not live long enough to make them all yourself...

              1 Reply Last reply Reply Quote 0
              • G Offline
                Gábor
                last edited by

                @driven said:

                cheers Gábor,

                I have a lot of them and the shorter the better...

                john

                I've entered the following lines in to the ruby console for the test:
                ` dlg = UI::WebDialog.new("TEST", true,"TEST", 739, 641, 150, 150, true);

                #UI::WebDialog:0xb4e49d8
                dlg.set_html('<html><head></head><body><div id="trans_L8"></div></body></html>')
                nil
                dlg.show
                true
                dlg.execute_script %Q(document.getElementById('trans_L8').innerHTML='Long';)
                true
                dlg.execute_script %Q(trans_L8.innerHTML='Short';)
                true`
                If somebody wants to try it with other version combinations...

                1 Reply Last reply Reply Quote 0
                • D Offline
                  driven
                  last edited by

                  or select all...

                  dlg = UI;;WebDialog.new("TEST", true,"TEST", 739, 641, 150, 150, true);
                  
                  dlg.set_html('<html><head></head><body><div id="trans_L8"></div></body></html>')
                  
                  dlg.show
                  
                  dlg.execute_script %Q(document.getElementById('trans_L8').innerHTML='Long';)
                  
                  dlg.execute_script %Q(trans_L8.innerHTML='Short';)
                  
                  

                  on mac you need to split it twice... but I know it works on mac...lol
                  john

                  learn from the mistakes of others, you may not live long enough to make them all yourself...

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Gábor
                    last edited by

                    Thank you for the formatting. The splitted version works on PC, IE11, SU 2014.

                    1 Reply Last reply Reply Quote 0
                    • 1 / 1
                    • First post
                      Last post
                    Buy SketchPlus
                    Buy SUbD
                    Buy WrapR
                    Buy eBook
                    Buy Modelur
                    Buy Vertex Tools
                    Buy SketchCuisine
                    Buy FormFonts

                    Advertisement