×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

VBS getElementByID no longer works on IE 11

VBS getElementByID no longer works on IE 11

VBS getElementByID no longer works on IE 11

(OP)
Hi Team

Kindly assist in the below. The code serves to load a webpage and input values from a spreadsheet. I have been using it for over 3 years with no problem. The issue started when we upgraded to IE 11...objIE.Document AND getElementByID are no longer recognized. Please assist as I am now doing this process manually and takes up much of my time. See below:


Set objIE = CreateObject("InternetExplorer.Application")
set WshShell = WScript.CreateObject("WScript.Shell")
objIE.Visible = True
objIE.FullScreen=True
objIE.Navigate "http://24088appjnb0003:81/CIB/NormalBatch/CIB_Batc..."

If jobname = "BO_VL_Offline" Then
With objIE.Document
.getElementByID("ctl00_MainContent_otGridView_ctl05_ot_Offline_Actual").value = oojobtimex
end with
End If

RE: VBS getElementByID no longer works on IE 11


VBScript is only supported in IE 10 and older. You can use it in IE11 but only in compatibility mode.


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

RE: VBS getElementByID no longer works on IE 11

(OP)
Thanks Mark

Im trying to switch to JS to achieve the same result....but now it won't identify "window" because it isn't running in DOM, i run the script from an external JS file. Is there a way...please see below:

var myWindow = window.open("http://24088appjnb0003:81/Prod/CIB/Batch_Jobs.aspx");
myWindow.document.getElementById("Content_acbsGridView_Offline_Actual_0").value = "00:00";

RE: VBS getElementByID no longer works on IE 11


The DOM is probably not fully loaded by the time you are trying to get and set the element. You can use setTimeout to repeatedly attempt the update. Works, but I don't trust it:

CODE

var winHandle;

            function LoadWindow() {
                // open the window
                var winHandle = window.open("http://24088appjnb0003:81/Prod/CIB/Batch_Jobs.aspx");

                // check to see if the opened window is fully loaded yet and can access the element
                checkLoaded();

                function checkLoaded() {
                    // see it yet?
                    var el = winHandle.document.getElementById("Content_acbsGridView_Offline_Actual_0"); 
                    if (el) {
                        // yes, do whatever
                        el.value= "00:00";
                        clearTimeout(checkLoaded);
                    }
                    else {
                        // assume not loaded yet, try again 
                        setTimeout(checkLoaded); 
                    } 
                }
            }; 


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close