How can i set the alt attribute of all img tags in a page

T

trallon

Hello, how are you? I need to set a default value into all the alt
attributes in my pages (ie: <img alt="".../> ), I have web controls
that nor are developed by me and they write img tags in my page. I
think that using javascript I can do this issue, but ¿what is the
better way?
TIA, trallon
 
R

Randy Webb

trallon said the following on 9/28/2006 2:13 PM:
Hello, how are you? I need to set a default value into all the alt
attributes in my pages (ie: <img alt="".../> ), I have web controls
that nor are developed by me and they write img tags in my page. I
think that using javascript I can do this issue, but ¿what is the
better way?

The best way is to put appropriate alt attributes in your code, either
manually (hard coded) or dynamically on the server. Putting an empty alt
attribute won't do any good.
 
D

Davey Erwin

trallon said:
I need to set a default value into all the alt
attributes in my pages (ie: <img alt="".../> ),



<script type="text/javascript">
function init(){
imgs = document.images;
for(i=0;i<imgs.length;i++){
imgs.alt="";
}
}
</script>
<body onload="init()">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top