我一直在研究这个问题,尝试你win.load(),win.ready()等等,但是没有成功,我试图用flot函数直接弹出子窗口,但是我找不到让函数等待dom满载的方法。因此,每次我让它自然运行它抱怨它找不到写入的div。当使用调试器时,如果我在窗口打开后使用firebug进行paude并让它再次运行,它可以正常工作。
if (newwindow) {
var win = window.open("pop_up.htm", 'window', "height=400,width=900");
$.plot($("#pie_chart", win.document), data,
{
series: {
pie: {
show: true
},
legend: {
show: false
}
}
});
}
else {
$.plot($(graph_id), data,
{
series: {
pie: {
show: true
},
legend: {
show: false
}
}
});
}
嗯,我到目前为止,它适用于FF但不适用于IE6 ....任何想法?
function generatePieChart(graph_id, objData, hyperlinks, newwindow) {
var data = objData;
for (var i = 0; i < data.length; i++) {
var num = parseInt(objData[i][1]);
if (hyperlinks == true) {
data[i] = { label: "<a class='user_pie_link super_light_box' id='" + objData[i][0] + "'>" + objData[i][0] + " <span style='float: right;'>" + objData[i][1] + "</span></a>", data: num }
}
else {
data[i] = { label: "<p id='" + objData[i][0] + "'>" + objData[i][0] + " <span style='float: right;'>" + objData[i][1] + "</span></p>", data: num }
}
}
if (newwindow) {
var win = window.open("pop_up.htm", "window", "height=400, width=900");
win.moveTo(50, 50);
$(win.document).load(function () {
generatePopOutPieChart(win, data);
});
}
else {
$.plot($(graph_id), data,
{
series: {
pie: {
show: true
},
legend: {
show: false
}
}
});
}
}
function generatePopOutPieChart(win, data) {
$.plot($("#pie_chart", win.document), data,
{
series: {
pie: {
show: true
},
legend: {
show: false
}
}
});
}