gpt4 book ai didi

javascript - 将外部 html 加载到 div 用外部 html 替换原始页面的内容

转载 作者:行者123 更新时间:2023-11-28 10:03:32 24 4
gpt4 key购买 nike

我使用此代码来放置外部 html 的内容

  jQuery(document).ready(function() {
$('#topdiv').load("2-0.html");

当页面加载时,它不会将该html放入id为topdiv的div中,而是重新加载整个页面并放入新的html而不是我的index.html

外部 html 只是在 div 中包含来自 Twitter 官方网站的 Twitter 小部件

<div style="float:right; margin:5px;">
<script src="http://widgets.twimg.com/j/2/widget.js"></script>
<script>
new TWTR.Widget({
version: 2,
type: 'search',
search: '#abbaseya',
interval: 15000,
subject: 'widget',
width: 300,
height: 360,
theme: {
shell: {
background: '#8ec1da',
color: '#ffffff'
},
tweets: {
background: '#ffffff',
color: '#444444',
links: '#1985b5'
}
},
features: {
scrollbar: true,
loop: true,
live: true,
behavior: 'default'
}
}).render().start();
</script>
</div>

最佳答案

var counter = 0;
var timer = null;
function progressBar(){
if (timer) {
clearTimeout(timer);
timer = null;
return;
}
timer = window.setInterval(function(){

$('#topdiv').load("2-0.html");

}, 10);
}

window.onload = function() {
progressBar();
};

这有效。每毫秒重新加载页面。

关于javascript - 将外部 html 加载到 div 用外部 html 替换原始页面的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8691188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com