Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (56.32 KB, 1 trang )
Code truyện cười ngẫu nhiên
<iframe id="ifrHTMLFunny" name=ifrHTMLFunny frameborder="0"
width="98%"></iframe>
<script type="text/javascript">
FHeaderColor = '#336666';
FBodyColor = '#000000';
FFontSize = '12px';
function getRandomPosts(json) {
var maxEntries = 1;
var numPosts = json.feed.openSearch$totalResults.$t;
var indexPosts = new Array();
for (var i = 0; i < numPosts; ++i) {
indexPosts[i] = i;
}
indexPosts.sort(function() {return 0.5 - Math.random()});
var entry = json.feed.entry[indexPosts[0]];
var RandomFunny =
document.getElementById('ifrHTMLFunny').contentWindow.document;
RandomFunny.open();
RandomFunny.write('<html><head></head><body><p class="header" style="font-
family: Arial, Tahoma, Verdana;color:' + FHeaderColor + ';font-size: '+ FFontSize
+';font-weight: bold;">'+ entry.title.$t + '</p><div align="justify" style="font-family:
Arial, Tahoma, Verdana;color:' + FBodyColor + ';font-size: '+ FFontSize +';font-
weight: normal;">' + entry.content.$t + '</div><p><b>Power by <a
href="">www.cuoititon.com</a><b></p></body></html>');
RandomFunny.close();
}
</script>
<script %C6%B0%E1%BB%9Di/?alt=json-in-script&callback=getRandomPosts&max-
results=999999" type="text/javascript">
</script>