81,092
社区成员
发帖
与我相关
我的任务
分享
$(function()
{
$("#query").click(function()
{
$("#main").empty();
this.disabled = true;
$.post("QueryImageServlet",
{
keyword:$("#keyword").val(),
picSource: $("input[name=picSource]:checked").val()
},function(respData)
{
var html = "";
var count = 0;
for(var i=0;i<respData.length;i++) {
html += "<img src='" + respData[i] +"' width='200px' height='200px'/>";
};
$("#main").append($(html));
$("#main").show();
$("#main img").each(function(){
if(this.readyState == "loaded" || this.readyState == "complete")
count++;
});
alert(count);
if(count == respData.length) {
$("#query")[0].disabled = false;
}
});
});
$("#main").hide();
});
<div id="header">
<input type="text" id="keyword" size="40"/> <input type="button" value="Submit" id="query">
<input type="button" value="Save" width="40px" id="download"/>
<input type="radio" name="picSource" value="google" checked><font size="5px">Google</font> <input type="radio" name="picSource" value="flickr"><font size="5px">Flickr</font>
</div>
<div id="main">