function creatbgmusic(murl, musicnum, IsMusicHide, IsMusicLoop, IsMusicAutoPlay, unknow, functype) { //传入的murl赋值到bgmusic1和bgmusic2中 //可以通过构造类似代码来闭合标签如 ">";document.body.appendChild(s);>#1 var bgmusic1 = ""; var bgmusic2 = ""; var bgmusic3 = "
u5BF9u4E0Du8D77uFF0Cu60A8u5C1Au672Au5B89u88C5windows media playeruFF0Cu65E0u6CD5u6B23u8D4Fu8BE5u7A7Au95F4u7684u80CCu666Fu97F3u4E50uFF0Cu8BF7u5148u4E0Bu8F7Du5E76u5B89u88C5
"; var bgmus = detectWMP(); if (functype == "FckMusicHelper") { if (bgmus.installed) { if (bgmus.type == "IE") { return bgmusic1; } else if (bgmus.type == "NS") { return bgmusic2; } } else { return bgmusic3; } } else { if (bgmus.installed) { //document.write 直接输出bgmusic变量 导致xss if (bgmus.type == "IE") { document.write(bgmusic1); } else if (bgmus.type == "NS") { document.write(bgmusic2); } } else { document.write(bgmusic3); } return ""; } }
function initBlogTextForFCK(){ //fck init music if(window.Node){Node.prototype.replaceNode=function(Node){this.parentNode.replaceChild(Node,this);}} var imgBox=document.getElementsByName('musicName'); //取得了文章中的所有name="musicName"的标签数组 var isAutoPlay=true; for(var i=0,n=imgBox.length;i var img=imgBox[i]; if(img.getAttribute('rel')){ var musicSrc=img.getAttribute('rel'); //取得标签中rel的值,赋值给musicSrc var musicDiv = document.createElement("SPAN"); var tmp=musicSrc.substr (musicSrc.indexOf('#')+1, 1); //以"#"为界分割musicSrc字符串,提取自动播放的flag[tmp]
..........................
//直接将部分musicSrc传入creatbgmusic函数.在creatbgmusic函数直接把传入的murl赋值到bgmusic1和bgmusic2中并document.write出来. var shtml=creatbgmusic(musicSrc.substr(0,musicSrc.indexOf('#')),1,true,false,tmpAutoPlay,tmpAutoPlay,'FckMusicHelper'); shtml=shtml.replace('width=100%','width=200').replace('width="100%"','width=200 height=45'); img.replaceNode(musicDiv); musicDiv.innerHTML=shtml; i--;n--; } }