473,788 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how does one get every element in a window into an array?

I've a graphic designer who wants to be able to see what he's styled
and what he so far hasn't. So I'd like to write a script that will
work in, say, FireFox, so that he can point FireFox at has websites
and the script will loop through the page after its loaded and perhaps
for each element do something like throw an alert() with the style
rules. I can call the style() method on each element to get its rules,
but how do I get every element?
Jul 23 '05 #1
2 1402
On 21 Nov 2004 11:04:07 -0800, lawrence <lk******@geoci ties.com> wrote:

[snip]
So I'd like to write a script that will work in, say, FireFox, so that
he can point FireFox at has websites and the script will loop through
the page after its loaded and perhaps for each element do something like
throw an alert() with the style rules.
If he's got Firefox or Mozilla, bring up the DOM Inspector from the Tools
menu. It will show the document tree. From the right-hand pane, you can
select various catagories of information to display, including CSS rules.
Click the element on the left to show the selectors that match that
element, then the selector on the right to show the rules.

It can confuse itself sometimes, so if that happens, close the inspector
and open a new instance.
I can call the style() method on each element to get its rules, but how
do I get every element?


document.getEle mentsByTagName( '*')

will retrieve a collection containing every element in the document.

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
> I can call the style() method...

Think you mean the Style object. You can read its properties, but it
won't help much if they've been set in a separate (outside the element
tag) stylesheet; pretty much returns empty strings. That's because it's
an actual DOM object, and if you don't set its properties directly, via
HTML's "style" attribute, or the object itself with JS, the values don't
"cascade" down the DOM hierarchy as the actual implementation of those
styles does. Here's one solution:

http://dhtmlkitchen.com/learn/js/setstyle/index4.jsp

Uses the DOM document.defaul tView.getComput edStyle() method or IE's
proprietary .currentStyle property.

You'll probably find some use for Steve Chipman's excellent favelets at
slayeroffice.co m - particularly MODI and Style Sheet Viewer.

http://slayeroffice.com/index.php

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 23 '05 #3

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

Similar topics

2
5349
by: hall | last post by:
I have a question regarding where memory is allocated when arrays are created. I'll illustrate this by example. I may be wrong on some details, do feel free to correct me. The code piece: int p; Creates a 2dimensional array. p can be thought of as a pointer, containing the adres of the first element in the array. The memory is
24
3828
by: David Mathog | last post by:
If this: int i,sum; int *array; for(sum=0, i=0; i<len; i++){ sum += array; } is converted to this (never mind why for the moment):
38
10179
by: ssg31415926 | last post by:
I need to compare two string arrays defined as string such that the two arrays are equal if the contents of the two are the same, where order doesn't matter and every element must be unique. E.g. these two arrays would test as equal: servers = "Admin" servers = "Finance" servers = "Payroll" servers = "Sales"
14
4863
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it can be done using the designer but I intentionally don't want to use that. The one reason is that you cannot change the code generated by the designer. The other could be that you have more free hand and control to design your GUI. 2....
5
2386
by: Cylix | last post by:
this.menus = { root: new Array };
1
9483
by: kamleshsharmadts | last post by:
I am using Ajax with struts in web application. from jsp i am calling a function of ajax.js onclick of a button. code of that call function which calling from jsp given as below:- onclick="retrieveURL('/application/home_page.do?processAction=ItinerarySearch','AfoHomeForm')" after clicking on button i am getting following error:- object does not support this property or method at statement (Which i have made it bold in js file)
14
3495
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src="" id="eventImage0" class="eventImage"><img src="" id="eventImage1" class="eventImage"></div>
19
1738
by: Prisoner at War | last post by:
Okay, Folks, I guess my real burning concern all along is a "high-level" one: just how does JavaScript interact with CSS? Right now, my newbie self only knows JavaScript and CSS to *co- exist*...but I'm beginning to get the sense that they actually interact -- or, perhaps more precisely, JavaScript acts upon CSS...but how, exactly??
1
3657
by: sva0008 | last post by:
i have a auto suggest script that does not work in firefox , works great on IE. /******************************************************* AutoSuggest - a javascript automatic text input completion component Copyright (C) 2005 Joe Kepley, The Sling & Rock Design Group, Inc. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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
10364
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
10110
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
9967
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...
1
7517
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
5398
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
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.