简体   繁体   中英

Display previous text when call function next time?

In my project, I need to show previous text when call function next time? My code is ..

HTML code is :-

<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";
}

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

document.getElementById("notes_id").value += "\nCurrent Time :- " +time+ "\n";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM