js 타이머 + asp 타이머

5922 단어 asp
JS:
<script type="text/javascript">

        var counts = 0;
        function starts() {
            if (counts == 1) {
                alert('')
                return false;

            }
            if (confirm("        ?")) {
                setInterval("GetJSMapGps()", 15000); //15 
                counts = 1;
                return true;

            }
            else return false;


        }
        function dw() {

            appletFrame.s_locationSet(124.805832, 46.571381);
        }

        function GetJSMapGps() {

            var gpsX;
            var gpsY;
            gpsX = window.document.getElementById("hdflog").value; //  
            gpsY = window.document.getElementById("hdflag").value; //  
            if (gpsX != null && gpsX != "" & gpsY != null && gpsY != "") {
                appletFrame.s_locationSet(gpsX, gpsY);

            }

        }

       
    </script>

asp:
protected void Timer1_Tick(object sender, EventArgs e)
    {
        string id = ViewState["mobileid"].ToString();
        if (!string.IsNullOrEmpty(id))
        {
            DataTable dtGps = GBLL.GetList(" imei = '" + id + "' order by intime desc ").Tables[0];
            if (dtGps.Rows.Count > 0)
            {
                string lat  = dtGps.Rows[0]["lat"].ToString();
                string lon = dtGps.Rows[0]["lon"].ToString();
                hdflog.Value = lon;
                hdflag.Value = lat;
            }
        }
    }
    protected void timersWatch_Click(object sender, EventArgs e)
    {
        Timer1.Interval = 10 * 1000;//10       
    }

좋은 웹페이지 즐겨찾기