<form id="form1" runat="server">
<div id="chart1">
</div>
</form>
<script type="text/javascript">
// Add a script element as a child of the body
function downloadJSAtOnload() {
var element1 = document.createElement("script");
element1.src = "js/jquery-1.7.2.js";
document.body.appendChild(element1);
var element2 = document.createElement("script");
element2.src = "js/jquery.jqplot.js";
document.body.appendChild(element2);
var element3 = document.createElement("script");
element3.src = "js/jqplot.canvasTextRenderer.js";
document.body.appendChild(element3);
var element4 = document.createElement("script");
element4.src = "js/jqplot.canvasAxisLabelRenderer.js";
document.body.appendChild(element4);
var element5 = document.createElement("script");
element5.src = "js/deferredfunction.js";
document.body.appendChild(element5);
//setTimeout("Func1()", 2000);
//Func1();
// $(window).bind("load", function() {
// Func1();
// });
}
function Func1() {
var plot1 = $.jqplot('chart1', [[3, 7, 9, 1, 4, 6, 8, 2, 5]]);
}
// Check for browser support of event handling capability
function chk_comp() {
if (window.addEventListener)
window.addEventListener("load", downloadJSAtOnload, false);
else if (window.attachEvent) {
debugger;
window.attachEvent("onload", downloadJSAtOnload);
}
else window.onload = downloadJSAtOnload;
}
chk_comp();
</script>
我收到错误。我想在页面加载完成后调用要调用的 jquery 函数,它会在加载所有必需的 .js 文件后自动触发函数“func1()”,但它没有发生。请帮助我