For example, there is such a problem.
Copy Code code as follows:
<div id= "Playlist" >
</div>
In this Div, add a play list. This list is added with innerHTML.
Copy Code code as follows:
var plst = null;
Plst = Player.getplaylist ();
if (plst) {
var txt = ';
for (var i in Plst) {
txt + ' <a name= ' fv_item_a_ ' + i + ' "></a><div class=" Fv_item "id=" fv_item_ ' + i + ' "><div class=" Playi NG_BG "Name=" PLAYING_BG "></div>";
TXT + + <div class= "playing" Name= "playing" > is playing ...</div> ';
txt = ' txt + + ' <p class= ' fv_playlist_title ' > ' + plst[i].title + ' </p> ';
TXT + + "</div>";
}
var obj= document.getElementById ("playlist");
if (obj) {
obj.innerhtml = txt;
}
}
The complex code in the middle doesn't have to be taken care of, now I'm going to take the name playing div out. It's easy to think of using
Getelementsbyname
However, it's very strange that you can't get it under IE. getElementById can be used completely.
Here's a good solution:
Copy Code code as follows:
function Getelementsbyname (tag, name) {
var elem = document.getElementsByTagName (tag);
var arr = [];
var index = 0;
var L = elem.length;
for (var i = 0; i < L; i++)
{
var att = elem[i].getattribute ("name");
if (att = = name) {
arr[index++] = Elem[i];
}
}
return arr;
}
Change to this function, you can take it. It just takes one more argument.
Do not know Bo friends have other solutions, this solution is not very perfect. Be sure to leave a message in the comments.