BUG: Document.Frames Collection Does Not Support For Each Syntax (191184)
The information in this article applies to:
- Microsoft Internet Explorer (Programming) 4.0
- Microsoft Internet Explorer (Programming) 4.01
- Microsoft Internet Explorer (Programming) 4.01 SP1
- Microsoft Internet Explorer (Programming) 5
- Microsoft Internet Explorer (Programming) 5.5
This article was previously published under Q191184 SYMPTOMS
When you try to enumerate through the Frames collection from Document
object using VBScript's "For Each" syntax, you get the following error
message:
Error: Object doesn't support this property or method
CAUSE
The Document.Frames collection does not support the functionality required
for the "For Each" syntax.
RESOLUTION
Use a regular FOR loop to enumerate through the Document.Frames collection.
For example, if you had the following code:
<SCRIPT LANGUAGE=VBSCRIPT>
Sub Window_OnLoad()
Dim f
For Each f In Document.Frames
MsgBox f.location.href
Next
End Sub
</SCRIPT>
You can change this code to use the regular for loop syntax as
follows:
<SCRIPT LANGUAGE=VBSCRIPT>
Sub Window_OnLoad()
Dim i
For i = 0 to document.frames.length - 1
MsgBox frames(i).location.href
Next
End Sub
</SCRIPT>
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
Modification Type: | Major | Last Reviewed: | 5/12/2003 |
---|
Keywords: | kbBug kbhtml kbieObj kbpending kbScript KB191184 |
---|
|