473,796 Members | 2,703 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing image on an ImageButton makes by button disappear

I am writing an asp.net application which is using image buttons for
the interface. I have some buttons that have a enabled and disabled
state. I have written javascript code to change the image on the button
when it is disabled. Below is a snippet:

document.all.bt nSignIn.src="Im ages/sign_in_disable d.gif";

This code correctly changes the image on the button. The problem is
that sometimes if you push the button, it will turn white almost as if
it is waiting to download the image. The page moves too quickly for it
to ever show the disabled version. However, you still see the button
"disappear" for a second before the new page loads.

I have tried to place a hidden version of the disabled image on the
site thinking it might force a download and cache it locally.

Anyone have an idea on how I can make the image switch instantly?
Thanks

Alex

Nov 19 '05 #1
2 1836
you are correct, its downloading the image. to cache it, in javascript
create a Image object.

<script>
var disabledImage = new Image()
disabledImage.s rc = "Images/sign_in_disable d.gif";
</script>

later:

document.getEle mentById("btnSi gnIn").src = disabledImage.s rc;

-- bruce (sqlwork.com)
<ab*******@gmai l.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
| I am writing an asp.net application which is using image buttons for
| the interface. I have some buttons that have a enabled and disabled
| state. I have written javascript code to change the image on the button
| when it is disabled. Below is a snippet:
|
| document.all.bt nSignIn.src="Im ages/sign_in_disable d.gif";
|
| This code correctly changes the image on the button. The problem is
| that sometimes if you push the button, it will turn white almost as if
| it is waiting to download the image. The page moves too quickly for it
| to ever show the disabled version. However, you still see the button
| "disappear" for a second before the new page loads.
|
| I have tried to place a hidden version of the disabled image on the
| site thinking it might force a download and cache it locally.
|
| Anyone have an idea on how I can make the image switch instantly?
| Thanks
|
| Alex
|
Nov 19 '05 #2
Bruce,

I tried your suggestion but I am experiencing the same behavior. As far
as I can tell setting the disabledImage.s rc =
"Images/sign_in_disable d.gif"; stores a URL in the variable. I think
this is the same as setting the ImageButton.src ...
Any ideas?

Thanks

Alex

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6589
by: Nicolas Keller | last post by:
Hi! I'm used to have Mozilla for testing my PHP sites when I'm coding. The site's nearly finished, now I've made a test with the Internet Exlporer... guess what... failed. The problem: I'm using a form that submit's (POST) its data via three different image buttons (depending on which button you click, something different should happen):
4
2450
by: Ester | last post by:
I have an interior design of a living room with lights and aircond image. My task is to load the living room image without any light and aircond images as background image of a WebForm after that I have to add image button which are lights and aircond images on top of this background image (living room). Instead of drag and drop an image button from the toolbox and browse the image link, I would like to load the image for the image button from...
2
2712
by: Ester | last post by:
Instead of drag and drop image button from Toolbox and name the image button id on the properties box, I would like to load image button ID from database. I created a database table that stores Image Button ID and Image (path name of the image for the image button). Example of the data will be: (ImgBtnLight, image\light.gif). The data type of the Image Button ID field in the database table is varchar whereas data type of image button in...
3
6395
by: David | last post by:
Hi, I am very new in the asp.net realm so this may be a very simple question for most of you. I want to put a little image icon in every button on my web form but there is no attribute in asp:Button allowing me to do this. Basically, the buttons are Text buttons except that there there is a small image icon before every button text. I am thinking about using Custom Control but I'm not sure if it is really necessary for my purpose....
2
3841
by: David Hearn | last post by:
I have an ImageButton control that I am using on one of my pages. Sometimes, this button will act as a button and redirect users to another page. But sometimes, it will just act as an image container. In this case, I don't want the default hand cursor to be displayed so that the user things that it is a hyperlink when it's not. I just want the default cursor to display as with any other image when the user passes the mouse over it. Any way...
4
6947
by: rkbnair | last post by:
Is there any way to display an image button instead of the traditional Edit/Update/Cancel push button in a datagrid (with bound data)?
5
2634
by: Varangian | last post by:
Hi there experts, Is there a way to convert a System.Drawing.Image to an ImageButton. Maybe using ChangeType I don't know! Thank you
10
2384
by: Edwin Knoppert | last post by:
I have an asp.net imagebutton with a clickevent. I have enclosed an anchor around the image and a small text. If i click the image the event is executed (while the href of the anchor shows in the statusbar) If the user clicks the image or the text beneat it it should do the same, executing the image asp.net server event. I can manage this fine using javascript but the href must contain a character to get the mousehand.
2
8799
by: smokeyd | last post by:
i am trying to create a simple image button rollover.. i have searched this forum and found a number of solutions but none seem to work. i am just trying to get the onmouseover to swap the image then restore when rolled out on a web page in vb.net. please can someone help?
0
9531
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10237
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10018
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9055
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7553
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5446
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4120
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3735
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.