我使用 javascript 来替换文本而不是附加它。现在我想使用 Jquery 而不是 Javascript 并附加它而不是替换文本。我该怎么做?document.getElementById("frame").srcdoc = 成绩单;是在 iframe 中放置文本和替换的位置。
这是我的javascript代码,
var text = "", transcript = "", cap = "", text2 = "", cap2 = "", cap3 = "", cap4 = "";
for(var i = 0; i < subtitleArray.length; i++)
{
var cueLineStart1 = parseFloat(subtitleArray[i][0]);
var cueLineStart2 = parseFloat(subtitleArray[i+1][0]);
var cueLineStart3 = parseFloat(subtitleArray[i+2][0]);
var cueLineStart4 = parseFloat(subtitleArray[i+3][0]);
var cueEnd4 = cueLineStart4 + parseFloat(subtitleArray[i+3][1]);
cap = subtitleArray[i][2];
cap2 = subtitleArray[i+1][2];
cap3 = subtitleArray[i+2][2];
cap4 = subtitleArray[i+3][2];
i+=3;
if (video.currentTime >= cueLineStart1 && video.currentTime <= cueEnd4)
{
transcript = cap + " " + cap2 + " " + cap3 + " " + cap4;
}
$("#subtitle").html(text);
document.getElementById("frame").srcdoc = transcript;
}
HTML5 iframe 代码,
<div class="frame">
<iframe id ="frame" srcdoc="<p></p>" width="930"></iframe>
</div>