在一个支持AJAX asp.net环境在客户端上下载照片每10秒? [英] Downloading photos on the client side every 10 seconds on an ajax enabled asp.net environment?
问题描述
有一个网站页面是与使用C#和Ajax asp.net codeD启用了。
我想一个非常快速加载网页;这是会与下面的架构发生;
1 - 首先是由文本框中显示的所有数据(共有50个文本框,它是一份申请表。)
2 - 当被请求的网页,并加载,然后我希望所有的照片显示,从附近的页面,直到它结束顶部的每个文本框10×10。 (每张照片是5 KB之间 - 20 KB)
我知道ImageHandler的问题是我怎么可以把所有这些想法变成现实生活中?
一些例子和想法将是伟大的!
谢谢
BK
(功能(图像元素){
VAR fetchImages =功能(){
如果(images.length大于0){
变种numImages = 10;
而(images.length大于0&放大器;&放大器; numImages--大于0){
//假设你的元素是< IMG>
的document.getElementById(elements.shift())的src = images.shift();
//如果不是你也可以设置背景(或将backgroundImage)CSS属性
//的document.getElementById(elements.shift())style.background =URL(+ images.shift()+)。
}
的setTimeout(fetchImages,5000);
}
} //绑定到窗口的onload
在window.onload = fetchImages;
//如果你要使用的东西像jQuery然后做这样的事情,而不是
// $(fetchImages);
}(['URL1','URL2','URL3'],['IMG1','IMG2','IMG3']))
类似的东西会做什么,我想,你的要求。
最后一行大概会喜欢的东西换成
}(小于(%)= ImageUrls%GT中,<%= ImageElements%GT;))
There is a web site page which is coded on asp.net with using c# and ajax is enabled too.
I want a very fast loading web page; which is going to happen with the following architecture;
1- First all data is shown by the text boxes (There are 50 text boxes, it is an application form.)
2- When the web Page is requested and loaded, then I want all the photos are shown near the each text boxes 10 by 10 from top of the page till the end of it. (Each photo is between 5 kb - 20 kb; )
I know ImageHandler's the question is how can I put all these idea into real life? some examples and ideas will be great ! thanks
bk
(function(images, elements) {
var fetchImages = function() {
if(images.length > 0) {
var numImages = 10;
while(images.length > 0 && numImages-- > 0) {
// assuming your elements are <img>
document.getElementById(elements.shift()).src = images.shift();
// if not you could also set the background (or backgroundImage) css property
// document.getElementById(elements.shift()).style.background = "url(" + images.shift() + ")";
}
setTimeout(fetchImages, 5000);
}
}
// bind to window onload
window.onload = fetchImages;
// if you're going to use something like jquery then do something like this instead
//$(fetchImages);
}(['url1', 'url2', 'url3'], ['img1', 'img2', 'img3']))
Something like that would do what, I think, you're asking.
The last line would probably be replaced with something like
}(<%=ImageUrls %>, <%=ImageElements %>))
这篇关于在一个支持AJAX asp.net环境在客户端上下载照片每10秒?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!