| || |
DOM & CSS
Been reading a few posts about DOM and web objects. Until now, we haven't had the need to use DOM for anything. However, some of our code can certainly be improved.
Here's the example:
On a web page, let's say we have an action. When we save the results, an image appears on the web page notifying the user that the save is in progress. When the save is complete, the image disappears from view and the save is finished.
The problem is that the image attributes are always the same, regardless if you can physically see the object on the page or not. Visible = True in all cases.
So I'm thinking DOM is the answer, but not quite sure how to attack the problem. I know if the style is 'block' the image is actually visible. 'None' the image isn't visible. Question is, how to I get that info using DOM? I was thinking something along these lines:
Set Browser = CreateObject("InternetExplorer.Application")
Set DOM = Browser.Document
Set MyImage = DOM. ???????
Not sure where to go from here. Right now, our network is down, so I can't really try anything. That's why I'm trying to gather some info during the down time.
Re: DOM & CSS
Does the image has an ID?
If Yes then try the following
Set obj = Browser("B").Page("Pb").Object.getElementById("the image ID")
Re: DOM & CSS
Thanks folks, your tips helped and we figured it out:
("Browser").Page("MyPage").Image("MyImage")GetTOPr operty("html id")
Set myObj = ("Browser").Page("MyPage").Object.getElementById(o bjID)
retVal = myObj.Style.display
If retVal = "none" Then
WebObjIsVisible = False
WebObjIsVisible = True
I suppose this method will work for all sorts of web objects. Thanks again, works great.