我试图在页面加载时自动运行一段 JavaScript。 代码本身只是弹出一个指向我们自助服务门户的链接...
// Requires jQuery!
jQuery.ajax({
url: "selfserviceportal.com",
type: "get",
cache: true,
dataType: "script"
});
我尝试使用 onload 和 onclick 但没有成功。 非常感谢任何帮助。
最佳答案
jQuery.ready()指定 DOM 完全加载时要执行的函数。
$(document).ready(function () {
// your code
}
关于javascript - 页面加载时自动运行 Javascript,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14439646/