1

在我的项目中,我需要在下次调用函数时显示以前的文本?我的代码是..

HTML 代码是:-

<div id="notes">
    <textarea rows="21" cols="38" id="notes_id" placeholder="Enter your notes here..." onclick="current_time('videoPlayer')" onblur="play_video()" >
    </textarea>
</div>

javascript:-

function current_time (player_id) {             
    var player = _V_(player_id);
    var secs = player.currentTime();
    var hours = Math.floor(secs / (60 * 60));

    var divisor_for_minutes = secs % (60 * 60);
    var minutes = Math.floor(divisor_for_minutes / 60);

    var divisor_for_seconds = divisor_for_minutes % 60;
    var seconds = Math.ceil(divisor_for_seconds);

    var time    = hours+ '::' +minutes+ '::' +seconds;
    player.pause();
    document.getElementById("notes_id").value = "Current Time :- " +time+ "\n";
}
4

1 回答 1

1

您可以简单地使用+=而不是=,因此单击文本时将添加到当前内容:

document.getElementById("notes_id").value += "\nCurrent Time :- " +time+ "\n";
于 2013-09-20T14:28:23.170 回答