Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi,
can ANYONE tell me what is wrong with this function CODE in JavaScript

C#
function sel_back(valid)
        {
            var links=new Array("item1","item2","item3","item4","item5","item6","item7","item8","item9","item10","item11","item12","item13","item14","item15","item16","item17","item18","item19","item20","item21","item22","item23","item24","item25","item26","item27","item28","item29","item30","item31","item32","item33","item34","item35","item36","item37","item38","item39","item40","item41","item42");//,"item43");
            document.getElementById(valid).style.backgroundColor="#082140";
            document.getElementById(valid).style.color="#FFFFFF";
            for(count =0 ; count<43; count++)
            {
            if(valid != links[count])
                {
                    document.getElementById(links[count]).style.backgroundColor="#ECF5FF";
                    document.getElementById(links[count]).style.color="#000000";
                }
            }
        }


its giving error "Object required" in IE7

THANK YOU
Posted

1 solution

change

for(count =0 ; count<43; count++)

to

for(count =0 ; count<41; count++)
 
Share this answer
 
Comments
Karthik. A 15-Jun-11 9:52am    
Or just use "for (count = 0; count < links.length; count++)"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900