﻿// JScript 文件
document.write("<script language='javascript' id='CodeFrom' type='text/javascript' src='http://hq.sinajs.cn/list=sh000001,sz399001,sh000011,sz399305'></script>");
document.write("<ul class='ub'>");
document.write("<li><span id='s1' style='margin-right:4px;'>上证指数</span>");
document.write("<span id='s2' style='margin-right:4px;'></span>");
document.write("<span id='s3'></span></li>");
document.write("<li><span id='z1' style='margin-right:4px;'>深证指数</span>");
document.write("<span id='z2' style='margin-right:4px;'></span>");
document.write("<span id='z3'></span></li>");
document.write("<li><span id='sf1' style='margin-right:4px;'>沪市封闭</span>");
document.write("<span id='sf2' style='margin-right:4px;'></span>");
document.write("<span id='sf3'></span></li>");
document.write("<li><span id='zf1' style='margin-right:4px;'>深市封闭</span>");
document.write("<span id='zf2' style='margin-right:4px;'></span>");
document.write("<span id='zf3'></span></li>");
document.write("</ul>");
//
//处理并绑定数据
function setdata()
{
    var sh1=hq_str_sh000001;
    var a=sh1.split(',');
    document.getElementById("s2").innerHTML=a[3];
    var shzf1=(parseFloat(a[3])/parseFloat(a[2])-1)*100;
    document.getElementById("s3").innerHTML=Math.round(shzf1*100)/100+"%"  ;//小数点后保留两位小数

    var sz1=hq_str_sz399001;
    var b=sz1.split(',');
    document.getElementById("z2").innerHTML=b[3];
    var szzf1=(parseFloat(b[3])/parseFloat(b[2])-1)*100;
    document.getElementById("z3").innerHTML=Math.round(szzf1*100)/100+"%"  ;//小数点后保留两位小数

    var shf1=hq_str_sh000011;
    var c=shf1.split(',');
    document.getElementById("sf2").innerHTML=c[3];
    var shfzf1=(parseFloat(c[3])/parseFloat(c[2])-1)*100;
    document.getElementById("sf3").innerHTML=Math.round(shfzf1*100)/100+"%"  ;//小数点后保留两位小数

    var szf1=hq_str_sz399305;
    var d=szf1.split(',');
    document.getElementById("zf2").innerHTML=d[3];
    var szfzf1=(parseFloat(d[3])/parseFloat(d[2])-1)*100;
    document.getElementById("zf3").innerHTML=Math.round(szfzf1*100)/100+"%"  ;//小数点后保留两位小数

    hq_str_sh000001="";
    hq_str_sz399001="";
    hq_str_sh000011="";
    hq_str_sz399305="";
    
    
    setTimeout("GetUrl()", 3000);
}
function GetUrl()
{
   var oldS=document.getElementById("CodeFrom");
        if(oldS) oldS.parentNode.removeChild(oldS);

        var t=document.createElement("script");
        t.src="http://hq.sinajs.cn/list=sh000001,sz399001,sh000300,sh000011,sz399305,"+new Date().getTime();;
        t.type="text/javascript";
        t.id="CodeFrom";
        document.getElementById('autojs').appendChild(t);


   setdata();
}

//两秒一刷新数据
setTimeout("GetUrl()", 3000);




