By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,798 Members | 1,440 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,798 IT Pros & Developers. It's quick & easy.

Looping and displaying Element ID's ?????

P: n/a
Mel
Can someone help me out please ???

I need to be able to display any and all element ID's with yellow
background whereever they appear on the screen.

Is this possible ?

I will be turning a flag in my URL to instruct the page to display all
emements that have ID associated with them.

Much appreciate it

Feb 14 '07 #1
Share this Question
Share on Google+
5 Replies

P: n/a
Mel wrote:
Can someone help me out please ???

I need to be able to display any and all element ID's with yellow
background whereever they appear on the screen.
How is the background set, in the markup or by a CSS style?
Is this possible ?
Just about anything is possible.

--
Ian Collins.
Feb 14 '07 #2

P: n/a
Mel wrote on 14 feb 2007 in comp.lang.javascript:
Can someone help me out please ???

I need to be able to display any and all element ID's with yellow
background whereever they appear on the screen.

Is this possible ?
No, Ids have no background, only certain elements have.
I will be turning a flag in my URL to instruct the page to display all
emements that have ID associated with them.
<script type='text/javascript'>
var da = document.all;
for (var el=0;el<da.length;el++)
if (da[el].id!='')
da[el].style.backgroundColor = 'yellow';
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 14 '07 #3

P: n/a
Mel
On Feb 14, 1:12 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
Mel wrote on 14 feb 2007 in comp.lang.javascript:
Can someone help me out please ???
I need to be able to display any and all element ID's with yellow
background whereever they appear on the screen.
Is this possible ?

No, Ids have no background, only certain elements have.
I will be turning a flag in my URL to instruct the page to display all
emements that have ID associated with them.

<script type='text/javascript'>
var da = document.all;
for (var el=0;el<da.length;el++)
if (da[el].id!='')
da[el].style.backgroundColor = 'yellow';
</script>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Thanks a whole bunch Evertjan;
It does half of what i need and i hope that you can help me out some
more.
What i need is to have the ID of the element displayed in yellow
around the area where the element is seen on the screen.

I need to make a data map of elements and dont want to keep looking at
the HTML code. So the BIG idea was to flip a flag in my url and see a
little YELLOW area with the ID of the element displayed in it.

Appreciate your help
Mel

Feb 14 '07 #4

P: n/a
"Evertjan." <ex**************@interxnl.netwrote in message
news:Xn********************@194.109.133.242...
Mel wrote on 14 feb 2007 in comp.lang.javascript:
>Can someone help me out please ???

I need to be able to display any and all element ID's with yellow
background whereever they appear on the screen.

Is this possible ?

No, Ids have no background, only certain elements have.
>I will be turning a flag in my URL to instruct the page to display all
emements that have ID associated with them.

<script type='text/javascript'>
var da = document.all;
for (var el=0;el<da.length;el++)
if (da[el].id!='')
da[el].style.backgroundColor = 'yellow';
</script>
It *may* not matter, I am not totally sure, but I would use

document.getElementsByTagName("*") before using document.all

My $0.02.

-Lost
Feb 14 '07 #5

P: n/a
Mel wrote on 14 feb 2007 in comp.lang.javascript:
On Feb 14, 1:12 pm, "Evertjan." <exjxw.hannivo...@interxnl.netwrote:
>Mel wrote on 14 feb 2007 in comp.lang.javascript:

<script type='text/javascript'>
var da = document.all;
for (var el=0;el<da.length;el++)
if (da[el].id!='')
da[el].style.backgroundColor = 'yellow';
</script>

Thanks a whole bunch Evertjan;
It does half of what i need and i hope that you can help me out some
more.
What you want is not always what you need,
but that could be an English thing?
What i need is to have the ID of the element displayed in yellow
around the area where the element is seen on the screen.
That was not what you asked, but:

da[el].style.border = 'yellow 2px solid';

Hoever you will overwrite a possible earlier style border, and could
compromize the spacial integrity of the page.
I need to make a data map of elements and dont want to keep looking at
the HTML code. So the BIG idea was to flip a flag in my url and see a
A querystring append to the url?
little YELLOW area with the ID of the element displayed in it.
Again another specification? ;-)

If ony you yourself use it as a development tool, why not use an existing
one, like the free Firefox include "web developer toolbar"?

I use that more often than not.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Feb 15 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.