当前位置:编程学习 > C#/ASP.NET >>

我想动态创建div,然后设置div的样式

 function creareXy() {
            xml = createXml();
            xml.open("get", "jsWifi.ashx?action=clickWifi", true);
            xml.setRequestHeader("If-Modified-Since", "0");
            xml.onreadystatechange = function () {
                if (xml.readyState == 4) {
                    if (xml.status == 200) {
                        var msg = xml.responseText;
                        var json = eval("(" + msg + ")");
                        for (var i = 0; i < json.length; i++) {
                            var locaX = json[i].LocationX;
                            var locaY = json[i].LocationY;
                            alert(locaX);
                            //要查的是Select_Data
                            var dataTime = json[i].DataTime;
                            var phyValue = json[i].PhysicsValues;
                            var EqpName = json[i].EquipmentName;
                            //alert(EqpName);
                            var bobyDiv = document.createElement("div");//我这样创建层哪里错了,
                            bobyDiv.style.position = "absolute";
                            bobyDiv.style.width = "20px";
                            bobyDiv.style.height = "20px";
                            bobyDiv.style.zindex = 1;
                            bobyDiv.style.top = locaY
                            bobyDiv.style.left = locaX;

                        }
                    }
                }
            }
            xml.send(null);
        }
--------------------编程问答-------------------- 为什么要自己写这个呢??
jq多好
$.ajax({success:function(data){
   $(body).append('<div></div>');
}}) --------------------编程问答-------------------- 我是要从数据库中读取xy 轴的值,绘制一个层,
补充:.NET技术 ,  图表区
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,