如何通过ajax添加图像? [英] How to add image by ajax?

查看:70
本文介绍了如何通过ajax添加图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在.aspx文件中有一个控件Web.Control.Image,而且我还有一个CheckBox.当CheckBox.Checked = true且我也有一个wait_.gif文件时,我想在myImage控件中添加一个Image.我想在myImage控件中添加Image之前运行此wait.gif文件.添加图像后,wait_.gif将隐藏或炫耀或处置.我只是想在myImage控件中添加图像后不在页面中显示wait_gif文件.请帮助我,因为我是ajax和asp.net的新手程序员.

谢谢.

I have a control Web.Control.Image in .aspx file And I have a CheckBox too. I want to add a Image in myImage control when CheckBox.Checked = true and I have a wait_.gif file too. I want to run this wait.gif file before Adding Image in myImage control. After add the image the wait_.gif will hide or show-off or dispose. Just I want to not appear the wait_gif file in the page after adding image in my myImage control. Please, help me as I am a novice programmer in ajax and asp.net.

Thank You.

推荐答案

我怀疑很多人都在发布这样的问题,不知道什么是AJAX.如果加载的图像取决于页面设置,则AJAX允许您获取要显示的图像的URL,而无需重新加载页面.但是不需要动态设置img标记的url(这并不关心它是否是服务器上的ASP.NET控件).您可以使用jquery或直接javascript设置图像的URL.加载图像时无法显示进度控件,因为加载图像时浏览器不会获得事件AFAIK,它会立即加载.

如果您是新手程序员",那么您应该考虑以合理的速度进行工作.您显然不知道AJAX的用途.要么首先关注AJAX/javascript,要么(更合乎逻辑)首先关注ASP.NET或MVC,然后稍后再学习客户端脚本.
I suspect a lot of people posting questions like this, have no idea what AJAX is. AJAX will allow you to get a URL of an image to show, without reloading the page, if the image you load changes, depending on the page settings. But it is not needed to dynamically set the url of an img tag ( which does not care if it was an ASP.NET control on the server ). You can use jquery or straight javascript to set the URL of an image. You can''t show a progress control while the image loads, because the browser doesn''t get an event AFAIK when the image has loaded, it just loads it right away.

If you''re a ''novice programmer'', then you should consider taking things at a reasonable pace. You clearly have no idea what AJAX is used for. Either focus on AJAX/javascript, or ( more logically ) focus on ASP.NET or MVC first, and come back to learning client side scripting later.


请按照我的回答-
进度栏不适用于回发触发器 [ ^ ].
按照此处提供的MSDN链接了解概念.
Please follow my answer -
Progress bar not working with postback trigger[^].
Follow the MSDN Link given there to understand the concept.


这篇关于如何通过ajax添加图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆