Jquery:
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="js/timeago.js" ></script>
$(document).ready(function(){
jQuery("abbr.timeago").timeago();
});html:
<abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
function Refresh() {
setTimeout(function(){
<?php echo 'var id = '.json_encode($_GET['id']).';'; ?>
$('#cmdz').load('cmdajax.php?id='+id);
},1000);
}#cmdz目录包含abbr标记。一段时间以前,onload可以正常工作,但是当div刷新时,它就不能工作了。
由于某些原因,jQuery("abbr.timeago").timeago();函数无法工作。你可以在这里找到完整的代码:after ajax call jquery function not working properly
发布于 2012-06-19 19:28:32
工作演示 http://jsfiddle.net/FFeE3/1/
您是否可以尝试从下面的链接获取您的time ago.js,以及您使用jQuery("abbr.timeago").timeago();的任何特殊原因您可以使用$("abbr.timeago").timeago();
希望这篇帮助rest的演示能给你更多的想法。干杯
脚本
<script type='text/javascript' src="https://github.com/petersendidit/jquery-timeago/raw/master/jquery.timeago.js"></script>代码
$("abbr.timeago").timeago();发布于 2012-07-23 02:02:50
试试Livestamp.js吧。它不显眼,而且可以自动更新。您需要提供的只是Unix时间戳。
发布于 2012-06-19 19:32:36
两种表示方式,这样或其他方式,但不要混合:-
jQuery(document).ready(function() {
jQuery("abbr.timeago").timeago();
});或
$(document).ready(function() {
$("abbr.timeago").timeago();
});https://stackoverflow.com/questions/11099902
复制相似问题