I have to change the innerHTML of a span with a class rather than an id. The reason I can't attach an id to it is it's part of code automatically generated by Joomla. Thus, I do not have direct access to it.
I wrote a quick script to do this, using an onload function on <body>. Here's the code:
And, I call it:Code:function changeRecBlogTitle(){ var spans = getElementsByTagName("span"); for (i = 0; i < spans.length; i++){ if spans[i].className = "separator"{ inner = spans[i].innerHTML; if(inner == "Blog"){ spans[i].innerHTML = "Recent Blogs"; } } } }
Finally, here is the <span>:HTML Code:<body onload="changeRecBlogTitle();">
I simple want to change "Blog" to "Recent Blogs." Any idea what I'm doing wrong?HTML Code:<span class="separator">Blog</span>



Reply With Quote

Bookmarks