【问题标题】:Refresh Div only no scroll仅刷新 Div 没有滚动
【发布时间】:2013-07-24 17:38:07
【问题描述】:

我一直在尝试刷新某个 div 标签,但我尝试了 AJAX,但我不能使用它,因为没有源文件可以从中提取它是从数据库程序中提取它(需要刷新的数据) 我需要一些代码来刷新,就像按下刷新按钮时一样,但仅限于某些 div id。任何人都可以做任何事吗?

我试过了,但是就像我说的没有文件,我可以在刷新页面的 html 文件所在的区域输入一个名称吗?

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> 
<script type="text/javascript">
setInterval( function refresh()
{
$('#drawaddrow').fadeOut('slow').load('0355.htm').fadeIn("slow");
}, 1500);
</script>

我也试过了

        <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>

但这会刷新整个页面,我只需要刷新一个 div id。无需滚动到顶部!

【问题讨论】:

  • 我认为您需要再次尝试 AJAX。您需要一个中介脚本也可以完成后端工作。你说“不是文件”的那个文件是你需要写的才能使 AJAX 工作
  • 但是没有刷新它的 html 文件。该页面是来自软件程序的数据的可视浏览器表示,该软件程序运行用于滴定过程的数学方程以找到浴液的浓度。我尝试刷新的页面显示来自测试的数据以及下一次测试的到期时间,因此刷新。

标签: javascript jquery html css ajax


【解决方案1】:

这可能会解决您的问题 (source):

$('#result').load('ajax/test.html #container');

当这个方法执行时,它会检索ajax/test.html的内容, 但随后 jQuery 解析返回的文档以查找元素 容器的 ID。插入此元素及其内容 进入带有结果 ID 的元素,以及检索到的其余部分 文档被丢弃。

假设你只有 'a.html' 并且你的 div 的 id 是 'divId',你需要放置在你的 refresh() 函数中:

$('#divId').load('a.html #divId');

编辑

那么代码应该是(在 div 中放置 javascript 函数并更改了“刷新”函数):

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <style type="text/css">
        body { 
            background-image: url('../Images/Black-BackGround.gif');
            background-repeat: repeat;
        }
        body td {
           font-Family: Arial; 
           font-size: 12px; 
        }
        #Nav a { 
            position:relative; 
            display:block; 
            text-decoration: none; 
            color:black; 
        }
    </style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js"></script> 
<script type="text/javascript">
setInterval( function refresh()
{
$('#toptable').load('0355.htm #toptable'); 
}, 1500);
</script>


</head>
<body>
<div id="toptable" align="center">

<SCRIPT type="text/javascript" src="../Images/jsdate.js"></script>
<SCRIPT type="text/javascript">function Jump(s){ window.location.href = s ;}</SCRIPT>
<script type="text/javascript">

    //====================================================================================================================
    //          Date Difference
    //====================================================================================================================

function GetDiff (dt) { 
    sMins = " Min";
    sHours = " Hrs";
    sDays = " Days";
    sSecs = " Secs";

    if ( Math.abs (DateDiff ("s", now, dt)) < 86400 ) {
        if ( Math.abs (DateDiff ("s", now, dt)) <= 3600 ) {
            return ((Math.floor(Math.abs (DateDiff ("s", now, dt)/60)*100)/100).toFixed(2) + sMins);
        }
        else
        {
            return ((Math.floor(Math.abs (DateDiff ("s", now, dt)/3600)*100)/100).toFixed(2) + sHours);
        }
    }
    else
    {
            return ((Math.floor(Math.abs (DateDiff ("s", now, dt)/86400)*100)/100).toFixed(2) + sDays);
    }
}
    //====================================================================================================================
    //          Function Draw Row
    //====================================================================================================================

</script>
<script type="text/javascript"> 
function DrawRow ( link,Status,Value,ResultName,DateTime,LSL,OPT,USL,LCL,UCL,LO1L,UO1L,LO2L,UO2L,CpK,CP,PPK,PP,TestDue,TestLate,ExpNeeded,ExpLate,AddsNeeded,AddsLate,Count,ActiveCount,Dummy1,ReviewedBy,TestID,ItemID,Dummy2,Test1,Test2,Test3,Test4,Test5,T1,T2,S ) {
    s = "#008A00";
    now = new Date();

    //====================================================================================================================
    //          Color Coding For Results
    //====================================================================================================================

    if ( (Number (Status) & 1073741824) > 0 ) { 
        s = "#C0C0C0";
        a = "center";
        h = "22";
        cr = "#000000";
        sz = "2";


    }
    else
    {

        a = "left";
        h = "22";
        sz = "1";
        cr = "#000000";
        if ( DateDiff ("n", DateTime, "01/01/1980 00:00") == 0 ) { 
            Value = "Not-Tested";       
            DateTime = "Not Tested";
            ResultName = ResultName + " - Needs To Be Tested";
        }
    }

    if (( Number(Status) & 4) > 0 ) { s = "#0000FF"; cr = "#FFFFFF"; }
    if (( Number(Status) & 32) > 0 ) { s = "#52CC29"; cr = "#000000"; }
    if (( Number(Status) & 16) > 0 ) { s = "#FF4D94"; cr = "#000000"; }
    if (( Number(Status) & 2) > 0 ) { s = "#FFFF00"; cr = "#000000"; }
    if (( Number(Status) & 1) > 0 ) { s = "#E80000"; cr = "#FFFF00"; }
    if (( Number(Status) & 8) > 0 ) { s = "#FF6600"; cr = "#000000"; }
    if (( Number(Status) & 0) > 0 ) { s = "008A00"; cr = "#000000"; }





    //====================================================================================================================
    //          Test Status Timing
    //====================================================================================================================

    ReviewIcon = "<p align='center' width='20' height='21'><font size='1'>&nbsp;</font>";   
    Dummy2 = "<b><p align='center' width='20' height='21'><font size='1'>&nbsp;</font></b>";
    if ( Number(ActiveCount) != -1 ) {
        sz = "1";
        a = "left";
        h = "22";
        if ( TestDue > "" && TestLate > "" ) {
            duedif = DateDiff ("s", TestDue, now);
            if ( DateDiff ("s", TestDue, now) >= 0.0 ) { ReviewIcon = "<img  src='../Images/Green-Test.png' width='20' height='21'>"; Dummy2 ="<strong><font size='"+sz+"' color = "+cr+">Due In " + GetDiff (TestLate);}

            else
            {
                duedif = Math.abs (duedif);
                if ( duedif < 3600 ) { duestg = String(Number(Math.floor((duedif/60)*100)/100).toFixed(2)) + " Min"; }
                if (( duedif < 86400 ) && ( duedif >= 3600 )) { duestg = String(Number(Math.floor((duedif/3600)*100)/100).toFixed(2)) + " Hrs"; }
                if ( duedif >= 86400 ) { duestg = String(Number(Math.floor((duedif/86400)*100)/100).toFixed(2)) + " Days"; }
                Dummy2= "<p align='center' width='20' height='22'><b><font size='1' color = "+cr+">Start In " + duestg + "</font></b>";
                ReviewIcon="<img  src='../Images/Blue-Test.png' width='20' height='21'>";
            }

        }
        if ( TestLate > "" ) {
            if ( DateDiff ("s", TestLate, now) >= 0 ) { ReviewIcon = "<img  src='../Images/Red-Test.png' width='20' height='21'>"; Dummy2 = "<strong><font size='1' color = "+cr+">Late By " + GetDiff (TestLate);}             
        }
        if ( TestDue <="" ) {ReviewIcon="<img  src='../Images/Not-Scheduled.png' width='20' height='21'>"; Dummy2 = "<b><font size='"+sz+"' color = "+cr+">Not Scheduled";
    }
        if ( Number(ActiveCount) < Number(Count) ) {ReviewIcon= "<img  src='../Images/GrayAstris.png' width='20' height='21'>"; Dummy12 = "<strong><font size='"+sz+"' color = "+cr+">Deactivated";

        }
    }

    //====================================================================================================================
    //          Date-Time Format
    //====================================================================================================================

    fmtDateTime = DateTime;
    if ( IsDate(DateTime) ) { 
        mnth = DatePart ("m", DateTime); 
        dy = DatePart ("d", DateTime);
        yr = DatePart ("yyyy", DateTime);   // full four-digit year
        yr2 = DatePart ("yyyy", DateTime)-2000;     //should provide last two-digits of year
        hrs = DatePart ("h", DateTime);
        mn = DatePart ("n", DateTime);
        sc = DatePart ("ss", DateTime);

        if ( mnth.toString().length == 1 ) { mnth = "0" + mnth; }
        if ( dy.toString().length == 1 ) { dy = "0" + dy; }
        if ( mn.toString().length == 1 ) { mn = "0" + mn; }

        ampm = "am";
        //bug#604
        if ( Number(hrs) >= 12 ) { 
            ampm = "pm";
            if (Number(hrs) >= 13) {
                hrs = String(Number(hrs) - 12); 
            }
        }

        fmtDateTime = (String(mnth) + "/" + String(dy) + "/" + String(yr2) + "  " + String(hrs) + ":" + String(mn) + " " + String(ampm));       

    }
    //====================================================================================================================
    //          Draw Result Name 
    //====================================================================================================================

    document.write( "<tr bgcolor='"+s+"' height='"+h+"' >" );
    document.write( "<td bg color='#000000' width='2%' height='21' >"+ReviewIcon+"</td>" );
    document.write( "<td "+link+" width='134' height='22'><p align='center'><b>"+Dummy2+"</b></font></td>" );
    document.write( "<td "+link+" width='55'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+Value+"</font></td>");
    document.write( "<td "+link+" width='243'><p align='"+a+"'><strong><font size='"+sz+"' color='"+cr+"'>&nbsp;&nbsp;"+ResultName+"&nbsp;&nbsp;</strong></font></td>" );
    document.write( "<td "+link+" width='100'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+ fmtDateTime +"</strong></font></td>" );
    document.write( "<td "+link+" width='52'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+LSL+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='52'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+OPT+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='52'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+USL+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='54'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+LCL+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='54'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+UCL+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='56'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+CpK+"&nbsp;</font></td>" );

    document.write( "</tr>" );
}

    //====================================================================================================================
    //          Function Draw Add Row
    //====================================================================================================================

 function DrawAddRow ( link,Status,Action,Amount,Unit,Consumable,DueBy,TestReportID,Dummy1,SignedOff,TestID,ItemID,Dummy2,DateTme ) {
    if ( SignedOff == 0 ) { 
        s = "#008A00"; 
        cr = "#000000";
        sz = "2";

        if ( (Number(Status) & 1073741824) > 0 ){ 
            s = "#C0C0C0";
            a = "center";
            h = "22";
            cr = "#000000";
            SignOffIcon = "&nbsp;";


        }
        else

    //====================================================================================================================
    //          Add Status
    //====================================================================================================================

        {
            a = "left";
            h = "18";
            sz = "1";
            if ( DueBy > "" ) {
                if ( DateDiff("n", now, DueBy) >= 0 ) { s = "#008A00"; cr="#000000"; Dummy2 = "<b><font size='"+sz+"' color = "+cr+">Due In " + GetDiff (DueBy); Dummy1 = "<img  src='../Images/Green-Test2.png' width='20' height='18'>";}
            if ( DueBy > "" ) {
                if ( DateDiff("n", DueBy, now) >= 0 ) { s = "#E80000"; cr="#FFFF00"; Dummy2 = "<b><font size='"+sz+"' color = "+cr+">Late By " + GetDiff (DueBy); Dummy1 = "<img  src='../Images/Red-Test2.png' width='20' height='18'>";}

            }
        }
        }


    //====================================================================================================================
    //          Draw Add Row
    //====================================================================================================================

        document.write( "<tr bgcolor='"+s+"' height='"+h+"' >" );
            document.write( "<td width='2%' ><p align='center'><B><font size='"+sz+"' color='"+cr+"'>"+Dummy1+"</td>" );
        document.write( "<td width='16%' ><p align='center'><B><font size='"+sz+"' color='"+cr+"'>"+Dummy2+"</td>" );
        document.write( "<td width=32%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;&nbsp;"+Consumable+"&nbsp;&nbsp;</font></td>" );
        document.write( "<td width='9%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+Action+"</font></td>");
        document.write( "<td width='10%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+Amount+"</font></td>");
        document.write( "<td width='7%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+Unit+"</font></td>" );
        document.write( "<td width='13%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+DueBy+"</font></td>" );
        document.write( "<td width='10%'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>"+TestReportID+"</font></td>" );
        document.write( "</tr>" );
    }
    }


function DrawRow2 ( link,Status,Value,ResultName,DateTime,LSL,OPT,USL,LCL,UCL,LO1L,UO1L,LO2L,UO2L,CpK,CP,PPK,PP,TestDue,TestLate,ExpNeeded,ExpLate,AddsNeeded,AddsLate,Count,ActiveCount,Dummy1,ReviewedBy,TestID,ItemID,Dummy2,Test1,Test2,Test3,Test4,Test5,T1,T2,S ) {
    s = "#008A00";
    now = new Date();



    //====================================================================================================================
    //          Color Coding For Results
    //====================================================================================================================

    if ( (Number (Status) & 1073741824) > 0 ) { 
        s = "#C0C0C0";
        a = "center";
        h = "22";
        cr = "#000000";
        sz = "2";


    }
    else
    {

        a = "left";
        h = "22";
        sz = "1";
        cr = "#000000";
        if ( DateDiff ("n", DateTime, "01/01/1980 00:00") == 0 ) { 
            Value = "<img  src='../Images/Not-Tested.png' width='53' height='23'>";     
            DateTime = "Not Tested";
            ResultName = ResultName + " - Needs To Be Tested";
        }
    }

    if (( Number(Status) & 2) > 0 ) { s = "#FFFF00"; cr = "#000000"; }
    if (( Number(Status) & 1) > 0 ) { s = "#E80000"; cr = "#FFFF00"; TestIcon = "FFFF00" }


    document.write( "<tr bgcolor='"+s+"' height='"+h+"' >" );
    document.write( "<td "+link+" width='245'><p align='"+a+"'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;&nbsp;"+ResultName+"&nbsp;&nbsp;</font></td>" );
    document.write( "<td "+link+" width='50'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+L01L+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='50'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+L01U+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='50'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+PpK+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='50'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+PpK+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='52'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+Pp+"&nbsp;</font></td>" );
    document.write( "<td "+link+" width='52'><p align='center'><b><font size='"+sz+"' color='"+cr+"'>&nbsp;"+Cp+"&nbsp;</font></td>" );

    document.write( "</tr>" );
    }


</script>

<table border="0" width="850" id="Nav" cellpadding="0" cellspacing="0" valign="top">
<tr>
<td stylE="float:none; height:60; width:850px; align:center;">

    <TABLE style="float:left;border:5px; border-style:outset;border-color:#E80000; height:20px; width:23%; border-spacing:0; border-collapes:collapse;">
<TR Style="background-color:#595959;color:FFFF00;"> <TH Style="border:1px solid #FFFF00;font-size:12px; width:45;height:20;"><div style="text-align:center; margin-bottom:-1px;">&nbsp;&nbsp;Symbol&nbsp;&nbsp;</TH>              <TH Style="border:1px solid #FFFF00;font-size:12px; width:125;height:20;"><div style="text-align:center; margin-bottom:-1px;">Meaning</TH> </TR>
<TR> <TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Not-Scheduled.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Not Scheduled</TD></TR>
<TR> <TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Gray-Astris3.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">&nbsp;&nbsp;Deactivated Tanks&nbsp;&nbsp;</TD></TR>
<TR> <TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Blue-Test.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test Scheduled</TD></TR>
<TR> <TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Green-Test.png); background-size:22px 24px; width:22; height:24; background-repeat:no-repeat; background-position:center;"></TD> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test In Process</TD></TR>
<TR> <TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Red-Test.png); background-size:22px 24px; width:22; height:24; background-repeat:no-repeat; background-position:center;"></TD> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test Late</TD></TR>



</TABLE>
<div align="center">
   <img style="float:none; margin-left:auto; margin-right:auto; margin-top:17px; border:10px ridge #E80000; width:199; height:101;"src="../Images/Logo.jpg" />

<TABLE style="float:right;border:5px; border-style:outset;border-color:#E80000; height:20px; width:23%; border-spacing:0; border-collapes:collapse;">
<TR Style="background-color:#595959;color:FFFF00;"> <TH Style="border:1px solid #FFFF00;font-size:12px; width:125;height:20;"><div style="text-align:center; margin-bottom:-1px;">Meaning</TH><TH Style="border:1px solid #FFFF00;font-size:12px; width:45;height:20;"><div style="text-align:center; margin-bottom:-1px;">&nbsp;&nbsp;Symbol&nbsp;&nbsp;</TH></TR>
<TR> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Not Scheduled</TD><TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Not-Scheduled.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD></TR>
<TR> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">&nbsp;&nbsp;Deactivated Tanks&nbsp;&nbsp;</TD><TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Gray-Astris3.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD></TR>
<TR> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test Scheduled</TD><TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Blue-Test.png); background-size:22px 24px; width:25; height:24; background-repeat:no-repeat; background-position:center;"></TD></TR>
<TR> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test In Process</TD><TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Green-Test.png); background-size:22px 24px; width:22; height:24; background-repeat:no-repeat; background-position:center;"></TD></TR>
<TR> <TD style="background-color:#000000; color:FFFF00; border:1px solid #FFFF00; font-family:'Arial'; font-size:12px; text-align:center; font-weight:bold;">Test Late</TD><TD style="background-color:#000000;color:FFFF00; border:1px solid #FFFF00;background-image: url(../Images/Red-Test.png); background-size:22px 24px; width:22; height:24; background-repeat:no-repeat; background-position:center;"></TD></TR>

</td>
</tr>
</div>
<div id="description>
        <table>
                        <tr>
                        <td style="height:5px; text-align:center;"></td></tr>
        </table>

        <table style="border-style:none; width:850px: height:73px; border-spacing:0; border-collapse:collapse; vertical-align:top; text-align:center;">
                <tr>
                <TD style="background-color:#000000;color:FFFF00; height:20px; text-align:center; font-face:arial; font-size:24px; font-weight:bold;">IEC's TrueLogic Dashboard</td>
                </tr>
</div>
<div id="group">
        <table>
                        <tr>
                        <td style="height:4px; text-align:center;"></td></tr>
        </table>


                    <table style="border-style:none; width:850px: height:73px; border-spacing:0; border-collapse:collapse; vertical-align:top; text-align:center;">
                        <td style="height:20px; text-align:center;"></td>
                            <TD style="background-color:#000000;color:FFFF00; height:24px; text-align:center; font-face:arial; font-size:20px; font-weight:normal;">[GroupName]</td>
</div>
<div id="object">

        <table>
                        <tr>
                        <td style="height:4px; text-align:center;"></td></tr>
        </table>


    <table style="border-style:none; width:850px; border-spacing:0; border-collapse:collapse; vertical-align:top;">
    <td style="float:left;width:5;"><a href=[BackLink]><img border="0" src="../Images/Back-ButtonB.gif" width="80" height="18"></td>
    <TD style="text-align:center; background-color:#000000;color:FFFF00; height:20px; font-face:arial; font-size:18px; font-weight:bold;">[ObjectName]</td>
    <td style="width:26px;">
    </table>
</div>
<div id="drawrow" align="center">
<table>
<tr><td style="height:8px;"></td></tr>

</table>

        <TABLE style="float:center;border:5px; border-style:outset;border-color:#E80000; width:850px; height:18px; border-spacing:0; border-collapes:collapse;" table border="1">
            <script type="text/javascript">
            DrawRow ("","1073741824","<b>Value</B>","<b>Result Name</b>","<b>Date - Time</b>","<b>LSL</b>","<b>Opt.</b>","<b>USL</b>","<b>LCL</b>","<b>UCL</b>","<b>LO1L</b>","<b>UO1L</b>","<b>LO2L</b>","<b>UO2L</b>","<b>CpK</b>","Cp","<b>Ppk</b>","<b>PP</b>","<b>ItemID</b>","Dummy1","Dummy2","Dummy3","Dummy4","Dummy5",1,-1,"Dummy6",1,0,0,"Dummy7");
            [ItemsHTML]</script>
        </table>

 <table>

    <tr><td style="height:20px;"></td></tr>

 </table>


        <TABLE style="float:center;border:5px; border-style:outset;border-color:#E80000; width:850px; border-spacing:0; border-collapes:collapse;" table border="1">
            <div id="addrow"><script type="text/javascript">
            DrawAddRow ("","1073741824","Action","Amount","Units","Chemical Additive","Due By","Report ID","","","0","0","Due Status");
            [AddItemsHTML]</script></div>
        </table>

<table>

    <tr><td style="height:20px;"></td></tr>

</table>



<table>

    <tr><td style="height:10px;"></td></tr>

</table>



 <table>


    <tr><td style="height:5px;"></td></tr>


</table>
</div>


<div id="signoff" align="center">
<table style="border-style:none; width:850px; border-spacing:0; border-collapse:collapse; vertical-align:top;">

    <td style="height:25px;">
        <table style="border-style:none; width:850px; border-spacing:0; border-collapse:collapse;">
            <tr>
                <TD style="background-color:#000000;color:FFFF00;bwidth:335px; text-align:left; font-size:10;">By TrueLogic Company Edited By International  Electronic Components</td>
                <td width="290"></td>
                <TD style="background-color:#000000;color:FFFF00; bwidth:135px; text-align:right; font-size:10;">[LastBuild]</td>
            </tr>
        </table>


<tr><td style="height:25px;"></td>
</td>
</div>
</tr>
</table>
</div>
</body>
</html>

【讨论】:

  • 但是没有 html 文件可以从中获取数据。所以 a.html 不存在。我想我对你在说什么感到困惑
  • 哪个文件或 url 包含您要加载到 de div 的数据?
  • 如果它没有滚动到顶部,我无法刷新整个页面图像会闪烁,但是如果它没有滚动到顶部,我需要它不要滚动到顶部。那有意义吗。有人告诉我 ajax 可以工作,但它不是从 htm 文件加载的,时间是从一个软件的数据库中刷新的..
  • @chrisw.iec Ajax 确实不会闪烁图像,也不会将页面滚动到顶部。但它需要一个文件来加载。如果您想要加载您所在的同一页面(就像您说“...就像您点击刷新按钮时所暗示的那样”),只需传递 ajax 它的名称。因此,如果您在 abc.html 中,请致电 $('#divId').load('abc.html #divId');,它只会重新加载 id="divId" 的 div。
  • 并且您确定执行与点击刷新按钮完全相同的功能,除了指定的 div id,因为我添加了淡入淡出以查看我是否拥有正确的代码和 div id淡入淡出,但时间不会像你点击刷新按钮时那样改变,如果你查看我的代码,刷新有问题,但淡入淡出没有问题我让它加载它从中获取信息的页面?
猜你喜欢
  • 2012-09-27
  • 2020-09-13
  • 2012-11-23
  • 2013-03-02
  • 1970-01-01
  • 2016-01-13
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多