473,774 Members | 2,252 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Get all tags in a famed page with IE5

I'm trying to get every tag in a page within a frameset. So far I can
get everything but IE 5 to behave by using:

// in the frame set
window.onload = function() {
mypage = window.frames['mainFrame'];
...
}

getAll = function() {
var allEl = mypage.document .getElementsByT agName(*);
...
}

The getElementsByTa gName(*) fails in IE 5 so I tried

var allEl = mypage.document .all;

but, alas, it returns an error.

How can I get a collection of all tags in a page from a frameset in IE 5?
Andrew Poulos
Jul 23 '05 #1
8 1540
VK
Wrong frame addressing

frame > frameset
alert (self.top.docum ent.all);

frame > frame
alert (self.top['mainFrame'].document.all);

frameset > frame
Locked for security issues: can be used (and it was used) to bypass
inter-domain frame security model.
So far I can get everything:
window.frames['mainFrame']; !
getElementsByT* agName(*); !

What a sorry wannaby are you using?

Jul 23 '05 #2
VK
> What a sorry wannaby are you using?

Under "wannabe" I meant a browser of course, nothing personal.

Jul 23 '05 #3
VK

In IE model frameSet doesn't have "frames" collection anymore

my bs ^ 2 (bs in square)
The only weak excuse that I did not use frames for several years by
now.

<html>
<head>
<title>Top Frameset</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script>
function test() {
//alert(self.docu ment.title);
alert(self.fram es['f2'].docume*nt.getE lementsByTagNam e('P')[0*].innerHTML);

}
window.onload=t est;
</script>
</head>

<frameset cols="50%,*">
<frame name="f1" src="frame1.htm l">
<frame name="f2" src="frame2.htm l">
</frameset>
</html>

Jul 23 '05 #4
VK wrote:
In IE model frameSet doesn't have "frames" collection anymore


my bs ^ 2 (bs in square)
The only weak excuse that I did not use frames for several years by
now.

<html>
<head>
<title>Top Frameset</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script>
function test() {
//alert(self.docu ment.title);
alert(self.fram es['f2'].docume*nt.getE lementsByTagNam e('P')[0*].innerHTML);

Sorry, but you've confused me. In IE 5, from a frameset, instead of doing:
var mypage = window.frames['mainFrame'];
var allEl = mypage.document .all;

I should do:
var allEl = self.frames['mainFrame'].document.all;

Isn't window.frames and self.frames not the say thing?

Andrew Poulos

Jul 23 '05 #5


Andrew Poulos wrote:
I'm trying to get every tag in a page within a frameset. So far I can
get everything but IE 5 to behave by using:

// in the frame set
window.onload = function() {
mypage = window.frames['mainFrame'];
...
}

getAll = function() {
var allEl = mypage.document .getElementsByT agName(*);
...
}

The getElementsByTa gName(*) fails in IE 5 so I tried

var allEl = mypage.document .all;

but, alas, it returns an error.


What kind of error? window.document .all since IE 4 gives a collection of
all elements in the document.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #6
VK wrote a bunch of nonsense, to which Andrew Poulos replied:
Sorry, but you've confused me. In IE 5, from a frameset, instead of doing:
var mypage = window.frames['mainFrame'];
var allEl = mypage.document .all;

I should do:
var allEl = self.frames['mainFrame'].document.all;

Isn't window.frames and self.frames not the say thing?
Yes, you're right, because window === self
And of course he implemented the very DOM methods that you are trying
to account for not having.

Andrew Poulos


I think I see the problem, here.

Lacking a getElementById, you're obviously being forced to use the .all
collection-- that much is readily apparent. But after fiddling with it
a bit, I was a bit miffed to note that given:
<html>
<frameset>
<frame id=frameA src=/test.html>
<frame id=frameB src=/test.html>
</frameset>
</html>
Oddly, the following will be true:
window.document .all === window.frames['frameB'].document.all
window.document .body.innerHTML ===
window.frames['frameB'].document.inner HTML
window.frames[1].all.length == 0 ???
Here was one solution (and yes, I know it's ugly, but it worked for
throwing together a quick test):

<html>
<head>
<script>

function loaded( x ) {
alert( x.body.innerHTM L );
}

</script>
<frameset rows=50%,50%>
<frame src=/test.html id=frameA></frame>
<frame src=/test.html id=frameB></frame>
</frameset>
</html>
Then, in the <body> tag of /test.html, I added this:
onload=top.load ed&&top.loaded( window.document )

It worked, but it's a bad way to do it and is very easily broken.


I also found that this worked, which you may find more useful:
<html>
<head>
<script>

function check( ) {
if( window.frames['frameB'].document.ready State == 'complete' )
alert( window.frames['frameB'].document.all.l ength );

else
setTimeout( check, 250 );
}

</script>
<frameset rows=50%,50%>
<frame src=/test.html id=frameA onload=check()> </frame>
<frame src=/test.html id=frameB></frame>
</frameset>
</html>
Apparently, until the document in frameB is actually built in the
browser, certain of its properties will refer to the parent window's
properties, in particular .all and .body

This behaviour is not at all what I would expect.

The onload in the <frame> element will fire as soon as the element is
loaded-- not necessarily the document to which it refers. The second
example above checks the referenced document's readyState every
quarter-second until it comes back as 'complete'. I'm not sure if
..readyState is implemented identically in IE4 -- you'll have to check
that.

Don't know if this information will help lead you to the specific
solution you're looking for, but hopefully it's better than nothing.

Jul 23 '05 #7
VK
Andrew & Random:

Now you guys are confusing me. Are all three of us talking about IE?
That one from Microsoft?

The code below works perfectly (just use some bogus files for
frame1.html and frame2.html). I'm using Windows XP SP1 + IE 6.0.2800

1) OnLoad fires, as it should, only after *all* frames are loaded (I
tested it on loading msn.com to the right frame, 8 sec delay before
alert).
2) No problem to access any elements in frame f1.
3) Definitely window.document .all !=
window.frames['f2'].docume*nt.all, as it's impossible.

And actually this test case equals to your OP that did *not* work for
you. I suggest to take the code below and try to bring it line by line
(checking after each change) to your current variant.
The problem is (if any) either in some extra coding you did not posted,
or in your *personal* IE.

<html>
<head>
<title>Frameset </title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
<script>
function test() {
var win = self.frames['f1'];
var doc = win.document;
var elm = doc.all;
alert(elm[0].innerHTML);
}
window.onload = test;
</script>
</head>

<frameset cols="50%,*">
<frame name="f1" src="frame1.htm l">
<frame name="f2" src="frame2.htm l">
</frameset>
<noframes>
<body bgcolor="#FFFFF F">
<p>No frames text</p>
</body>
</noframes>
</html>

Jul 23 '05 #8
Martin Honnen wrote:


Andrew Poulos wrote:
I'm trying to get every tag in a page within a frameset. So far I can
get everything but IE 5 to behave by using:

// in the frame set
window.onload = function() {
mypage = window.frames['mainFrame'];
...
}

getAll = function() {
var allEl = mypage.document .getElementsByT agName(*);
...
}

The getElementsByTa gName(*) fails in IE 5 so I tried

var allEl = mypage.document .all;

but, alas, it returns an error.

What kind of error? window.document .all since IE 4 gives a collection of
all elements in the document.

The error's solved. You guys were right: I was calling getAll before the
page had loaded. Funnily enough IE6 didn't complain.

Andrew Poulos
Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
3860
by: Christian Hvid | last post by:
Hello groups. I have a series of applet computer games on my homepage: http://vredungmand.dk/games/erik-spillet/index.html http://vredungmand.dk/games/nohats/index.html http://vredungmand.dk/games/platfoot/index.html http://vredungmand.dk/games/minorbug/index.html http://vredungmand.dk/games/timbuktu/index.html http://vredungmand.dk/games/taleban/index.html
24
3553
by: Day Bird Loft | last post by:
Web Authoring | Meta-Tags The first thing to understand in regard to Meta Tags is the three most important tags placed in the head of your html documents. They are the title, description, and keyword meta-tags. If you are missing any of these meta-tags you are missing the boat. If you use the following meta-tag formula, and you are not trying to deceive the spiders, I guarantee you will succeed in increasing your placement in the...
2
1719
by: Got2Go | last post by:
Hello, I am trying to come up with a function that will search the source of the page for a specific string. If that string is found, then have it modify specific tags inside of a table and display a link on the page. This link, when clicked will then restore the modified tags back to their original values.
1
1465
by: D. Shane Fowlkes | last post by:
I'm a fairly skilled traditional ASP/VB programmer and am learning .NET. I was (recently) surprised to read in a book about declaring and defining all my page Functions in <script runat="server"></script> tags and these tags "should" be after the <html> tag but before the <body> tag. I'm used to writing all of my "logic" including functions, in block delimiter tags such as <% %> above the <html> tag. So, is my method now "old school"...
7
2751
by: Rocky Moore | last post by:
I have a web site called HintsAndTips.com. On this site people post tips using a very simply webform with a multi line TextBox for inputing the tip text. This text is encode to HTML so that no tags will remain making the page safe (I have to convert the linefeeds to <BR>s because the Server.EncodeHTML does not do that it seems). The problem is that users can use a special tag when editing the top to specify an area of the tip that will...
2
1271
by: ZMan | last post by:
I'm trying to format some data out as an RSS feed. I already have a perfectly good ASPX page that does the same thing with an <asp:repeater> so I figured I'd take the page change the html tags to RSS tags and it would all work fine. Problem is that it appears that there's no way to tell VS or the compiler that I really do want to push out XML and it complains that the XML tags are not valid in 'the active schema' <%@ Page...
23
3098
by: Big Bill | last post by:
http://www.promcars.co.uk/pages/bonnie.php I don't believe they should be there, can I take them out without stopping the includes from functioning? I'm the (hapless) optimiser on this one... I have to correct where they've spelled my name wrong too...sigh... BB --
10
3114
by: Barry L. Camp | last post by:
Hi all... hope someone can help out. Not a unique situation, but my search for a solution has not yielded what I need yet. I'm trying to come up with a regular expression for a RegularExpressionValidator that will allow certain HTML tags: <a>, <b>, <blockquote>, <br>, <i>, <img>, <li>, <ol>, <p>, <quote>, <ul>
3
2117
by: MikeB | last post by:
Hello, I have a content page that is from a Master page which has 2 content panes. How do I add my forms to the content page? Each pane needs a form but you can not have multiple form tags nor can the form tages be outside of the content tags? Does this make since? Below is my source to the pages. Basically I need both content tags to have form tags.
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10267
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10040
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8939
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7463
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4012
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.