alexjewell
06-10-2010, 11:06 PM
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:
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";
}
}
}
}
And, I call it:
<body onload="changeRecBlogTitle();">
Finally, here is the <span>:
<span class="separator">Blog</span>
I simple want to change "Blog" to "Recent Blogs." Any idea what I'm doing wrong?
I wrote a quick script to do this, using an onload function on <body>. Here's the 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";
}
}
}
}
And, I call it:
<body onload="changeRecBlogTitle();">
Finally, here is the <span>:
<span class="separator">Blog</span>
I simple want to change "Blog" to "Recent Blogs." Any idea what I'm doing wrong?