这个问题是关于Javascript写视频播放器的HTML代码。我认为有一些更快的方法(document.createElement,Jquery等)。请告诉一些更好和更快的方法来执行此过程。在此先感谢Javascript-更好的书写方式HTML
function createPlayer(videoSource){
document.writeln("<div id=\"player\">");
document.writeln("<object width=\"489\" height=\"414\" >");
document.writeln("<param name=\"player\" value=\"bin- debug/FlexPlayer.swf\">");
//etc
document.writeln("</embed>");
document.writeln("</object>");
document.writeln("</div>");
}
不止一次写入DOM是一件坏事。你应该建立一个字符串并将其写入页面。 – epascarello