Javascript jquery Ajax方法中的.load()可以用来加载图像吗?
我可以问一下jqueryajax加载图片的方法吗,下面是我的代码,失败了,有人能纠正吗Javascript jquery Ajax方法中的.load()可以用来加载图像吗?,javascript,jquery,image,methods,load,Javascript,Jquery,Image,Methods,Load,我可以问一下jqueryajax加载图片的方法吗,下面是我的代码,失败了,有人能纠正吗 <html> <head> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("div").ajaxStart(function(){ $(this
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").ajaxStart(function(){
$(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
});
$("button").click(function(){
$("div").load("http://www.google.com/images/logos/ps_logo2.png/");
});
});
</script>
</head>
<body>
<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>
</body>
</html>
$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”)。加载(“http://www.google.com/images/logos/ps_logo2.png/");
});
});
让AJAX更改此文本
更改内容
否。只需创建一个img
元素,设置src
,并将其放置在您希望的位置
$("div").empty().append($("<img/>", {src: "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"}));
$(“div”).empty().append($(“
否。只需创建一个img
元素,设置src
,并将其放置在您希望的位置
$("div").empty().append($("<img/>", {src: "http://www.google.com/intl/en_ALL/images/srpr/logo1w.png"}));
$(“div”).empty().append($(“
可能是
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").ajaxStart(function(){
$(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
});
$("button").click(function(){
$("div").html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
});
});
</script>
</head>
<body>
<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>
</body>
</html>
$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”).html(“”);
});
});
让AJAX更改此文本
更改内容
可能是
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").ajaxStart(function(){
$(this).html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
});
$("button").click(function(){
$("div").html("<img src='http://www.w3schools.com/jquery/demo_wait.gif' />");
});
});
</script>
</head>
<body>
<div><h2>Let AJAX change this text</h2></div>
<button>Change Content</button>
</body>
</html>
$(文档).ready(函数(){
$(“div”).ajaxStart(函数(){
$(this.html(“”);
});
$(“按钮”)。单击(函数(){
$(“div”).html(“”);
});
});
让AJAX更改此文本
更改内容
我想要的是在加载大图像时,而不是观看图像加载,我想要一个预加载程序,直到图像完全加载。谢谢!!@戏剧,那么你可能会觉得有用。我想要的是在加载大图像时,而不是观看图像加载,我想要一个预加载程序,直到图像完全加载。谢谢!!@戏剧,那么你呢可能会有帮助。