自动刷新不滚动做到这一点的最佳方式这一点、方式

2023-09-11 01:31:55 作者:醉不为红颜

所以我再次问这个问题,因为没有人能搞清楚。我需要刷新我的网页的某一部分每隔几秒钟,我尝试过阿贾克斯,但因为它需要.load,然后将脚本文件不起作用,因为刷新是不会改变的时间,直到测试是由于在章节,我需要刷新。数据是从一个访问数据库未来并且被显示在浏览器。该数据库由和由一个软件,它记录镀浴的化学浓度由数学方程昱欧程序进入软件改变,则可以应遵循FPR这些测试需要设置时间表。在Web浏览器则显示此信息。到目前为止,我只能得到整个页面刷新,没有滚动到顶端此code。 自动刷新不滚动在

So i'm asking this question again because no one has been able to figure it out. I need to refresh a certain part of my page every few seconds I've tried ajax, but because it requires .load and then the script file that doesn't work, because the refresh is not changing the time till a test is due on the sections I need refreshed. The data is coming from an access database and being displayed in a browser. The database is made and changed by a piece of software that records chemical concentrations of plating baths by mathematical equations yuou program into the software, you can setup schedules that need to be followed fpr these tests. The web browsers then displays this info. So far I can only get the whole page to refresh with no scroll to top with this code. Auto Refresh No Scroll Below

<script type="text/javascript">
    function refreshpage () {
        var page_y = document.getElementsByTagName("body")[0].scrollTop; 
    window.location.href = window.location.href.split('?')[0] + '?page_y=' + page_y;} 

   window.onload = function () {
        setTimeout(refreshpage, 1500);
        if (window.location.href.indexOf('page_y') != -1 ) {
            var match = window.location.href.split('?')[1].split("&")[0].split("=");
            document.getElementsByTagName("body")[0].scrollTop = match[1];

        }
    }
</script>

我已经试过Ajax和淡入和淡出,看看它的工作,但时间不会更新,如code anove这一点。 阿贾克斯code刷新事业部ID下面

I've tried Ajax with fade in and fade out to see if its working but the time does not update like the code anove this. Ajax Code to refresh Div ID Below

 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> 
 <script>
var auto_refresh = setInterval(
function ()
{

        $('#drawrow').fadeOut('slow').load('ObjectShellHTML.htm').fadeIn("slow");

}, 9000); 
</script>

该信息出来的数据库与该脚本重点括号。 [ItemsHTML]似乎来获取数据,而平局行绘制数据上面列。我需要的只是刷新了括号内的信息。但是,只有将刷新IE的刷新按钮或自动刷新没有滚动脚本从顶部

The info comes out of the database with this script focus on the brackets. [ItemsHTML] seems to grab the data while the draw row draws the columns above the data. I need the info in the brackets refreshed only. But only refreshes with the IE refresh button or the auto refresh no scroll script from the top

<div id="drawrow"><script type="text/javascript">
            DrawRow ("",Dummy1","Dummy2","Dummy3","Dummy4","Dummy5",1,-1,"Dummy6",1,0,0,"Dummy7");
            [ItemsHTML]</script></div>

我已经div标签,因为我需要刷新的部分,但就像我说的,没有源文件与.load加载数据。有没有刷新就像推我的刷新按钮数据的任何其它方式 E或使用我张贴了第一个脚本,而只是专注于网页的drawrow部分刷新?主要的原因是有大量的图片,并没有滚动似乎闪烁如果页面不滚动顶端大问题刷新每隔1.2秒,这就是我试图完成刷新。我已经使用源文件我写在加载的.load不工作,要么尝试。任何帮助是极大AP preciated!

I have div tags for the section I need refreshed but like I said there is no source file to load the data with .load. Is there any other way to refresh data like pushing the refresh button on I E or using the first script I posted, but only focusing the refresh on the drawrow part of the page? The main reason for this is there are a lot of images and the refresh with no scroll seems to flash if the page is not scrolled to the top big problem refreshing every 1.2 seconds which is what i'm trying to accomplish. I've tried using the source file im writing in to load for .load that doesn't work either. Any help is greatly appreciated!!!

推荐答案

原来我可以使用Ajax,但我不能选择我要加载页面的股利。我只能插入来自网页全HTML到我选择div。然而,有一个内存泄漏我想不出???

Turns out I can use ajax but I cannot select the div from the page I want to load. I can only insert the whole html from a page into the div I select. However there is a memory leak I can't figure out???

    loc = window.location.pathname; //grabs page url
pagediv1 = "#pageBody";
pathName = loc.substring(48, loc.lastIndexOf('.') + 4); //parses out url except for htm file name
setTimeout (function() {  

    $(pagediv1).load(pathName, null, function() { 

                });
     },3000);