I am using the outerHTML property to modify the HTML of existin
elements in a web page in Internet Explorer. But same outerHTM
property is not working in firefox browser, Anybody can tell me a
alternative for outerHTML property in firefox. I am using th
following function to display an image and alternate text behind al
images of a weg page in Internet Explorer. Anybody can give solutio
for same in firefox browser.
function showimage()
{
var z=0,
tag=new Array('img');
for(n=0;n<tag.length;n++)
{
t=document.getElementsByTagName(tag[n]);
arr_lst=new Array();
{
for(i=0;i<t.length;i++)
{
{
var l;
if ((t[i].attributes.alt.specified) && (t[i].alt!=0) &
(t[i].alt!="") && (t[i].alt.toLowerCase()!=".gif") &&
(t[i].alt.toLowerCase()!=".jpg") && (t[i].alt.toLowerCase()!=".png") &
(t[i].alt.toLowerCase()!="bytes") && (t[i].alt.toLowerCase()!="kb") &
(t[i].alt.toLowerCase()!="click here") &
(t[i].alt.toLowerCase()!="more"))
{
l='alt=\"'+t[i].alt+'\"';
h=t[i].outerHTML;
t[i].outerHTML='<INPUT TYPE="image" alt="Valid Alt Text
SRC="http://www.rampweb.com/toolbar/Images/alt_good.gif"><spa
style=\"color:#91060A;font:x-small arial;background:#FFFFC0;\"><b>'+
'+l+'</b></span> '+h;
t[i].style.padding='3px',t[i].style.border='1px solid #91060A';
}
else if ((t[i].attributes.alt.specified)&&(t[i].alt==0) &
(t[i].alt==""))
{
l='<INPUT TYPE="image" alt="Empty alt text"
SRC="http://www.rampweb.com/toolbar/Images/alt_empty.gif">';
h=t[i].outerHTML;
t[i].outerHTML='<span style=\"color:#91060A;font:x-small arial;\">
+l + '</span>'+h;
t[i].style.padding='3px',t[i].style.border='1px solid #91060A';
}
else if ((t[i].attributes.alt.specified) && (t[i].alt!=0) &
(t[i].alt!="") && (t[i].alt.toLowerCase()==".gif" |
t[i].alt.toLowerCase()==".jpg" || t[i].alt.toLowerCase()==".png" |
t[i].alt.toLowerCase()=="bytes" || t[i].alt.toLowerCase()=="kb" |
t[i].alt.toLowerCase()=="click here" |
t[i].alt.toLowerCase()=="more"))
{
l='alt=\"'+t[i].alt+'\"';
h=t[i].outerHTML;
t[i].outerHTML='<INPUT TYPE="image" alt="Warning: Make sure alt i
descriptive
SRC="http://www.rampweb.com/toolbar/Images/alt_warning.gif"><spa
style=\"color:#91060A;font:x-small arial;background:#FFFFC0;\"><b>'+
'+l+'</b></span> '+h;
t[i].style.padding='3px',t[i].style.border='1px solid #91060A';
}
else
{
l='<INPUT TYPE="image" alt="Error: missing alt text
SRC="http://www.rampweb.com/toolbar/Images/alt_error.gif">';
h=t[i].outerHTML;
t[i].outerHTML='<span style=\"color:#91060A;font:x-smal
arial;\">'+l+'</span>'+h;
t[i].style.padding='3px',t[i].style.border='1px solid #91060A';
}
}
if(h!='')
z=z+1;
}
}
}
if(z==0)
alert('No Images')
--
prasaddevivar
-----------------------------------------------------------------------
prasaddevivara's Profile:
http://www.highdots.com/forums/member.php?userid=9
View this thread:
http://www.highdots.com/forums/showthread.php?t=134380