472,989 Members | 3,089 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,989 software developers and data experts.

Dynamically Changing an Image

I am interacting with an OCX on the client side. In the Onload event of the page, I am checking a property of the OCX: Is the port open or closed.

If the port is open, I want a certain image to appear. If the port is closed, a different image.
Sounds pretty straight forward.

Since this is dependent upon a property of a client side component, I can't do this with VB .net on the server, right?

So I was trying to use vbscript on the client like this:

If Form1.CardReader.PortOpen = True Then
Document.getElementById("lblPortStatus").innerText = "Card reader is active."
Document.getElementById("imgStatus").setAttribute( "src", "images/CR_On.jpg")
Else
Document.getElementById("lblPortStatus").innerText = "Card reader is NOT active."
Document.getElementById("imgStatus").setAttribute( "src","images/CR_Off.jpg")
End If

What I've kinda figured out is that I can't really just change the src text 'cause I'm already at the client. So how do I have the images "cached" so that I can change the src dynamically? Or am I completely misunderstanding the problem?

Any help is appreciated. Thanks.

Jerry
Nov 19 '05 #1
5 1874
following javascript would change an image to diffrent one

document["imgStatus"].src = "images/CR_On.jpg";

the VB Script syntax would be following ?.. I am not very familair with
VB Script

document("imgStatus").src = "images/CR_On.jpg"

Nov 19 '05 #2
Jerry,

Sure you can set the src on the client. The image control will get another image and render it, no problem.

Eliyahu

"Jerry Camel" <rl*****@msn.com> wrote in message news:Og**************@TK2MSFTNGP14.phx.gbl...
I am interacting with an OCX on the client side. In the Onload event of the page, I am checking a property of the OCX: Is the port open or closed.

If the port is open, I want a certain image to appear. If the port is closed, a different image.
Sounds pretty straight forward.

Since this is dependent upon a property of a client side component, I can't do this with VB .net on the server, right?

So I was trying to use vbscript on the client like this:

If Form1.CardReader.PortOpen = True Then
Document.getElementById("lblPortStatus").innerText = "Card reader is active."
Document.getElementById("imgStatus").setAttribute( "src", "images/CR_On.jpg")
Else
Document.getElementById("lblPortStatus").innerText = "Card reader is NOT active."
Document.getElementById("imgStatus").setAttribute( "src","images/CR_Off.jpg")
End If

What I've kinda figured out is that I can't really just change the src text 'cause I'm already at the client. So how do I have the images "cached" so that I can change the src dynamically? Or am I completely misunderstanding the problem?

Any help is appreciated. Thanks.

Jerry
Nov 19 '05 #3
I never would have figured you for an HTML
green background color user, Eliyahu.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:ej***************@TK2MSFTNGP09.phx.gbl...
Jerry,

Sure you can set the src on the client. The image control will get another image and
render it, no problem.

Eliyahu

"Jerry Camel" <rl*****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP14.phx.gbl...
I am interacting with an OCX on the client side. In the Onload event of the page, I am
checking a property of the OCX: Is the port open or closed.

If the port is open, I want a certain image to appear. If the port is closed, a
different image.
Sounds pretty straight forward.

Since this is dependent upon a property of a client side component, I can't do this with
VB .net on the server, right?

So I was trying to use vbscript on the client like this:

If Form1.CardReader.PortOpen = True Then
Document.getElementById("lblPortStatus").innerText = "Card reader is active."
Document.getElementById("imgStatus").setAttribute( "src", "images/CR_On.jpg")
Else
Document.getElementById("lblPortStatus").innerText = "Card reader is NOT active."
Document.getElementById("imgStatus").setAttribute( "src","images/CR_Off.jpg")
End If

What I've kinda figured out is that I can't really just change the src text 'cause I'm
already at the client. So how do I have the images "cached" so that I can change the src
dynamically? Or am I completely misunderstanding the problem?

Any help is appreciated. Thanks.

Jerry

Nov 19 '05 #4
Well, gone are those days when you could tell a real programmers by his
non-stop typing into a black MSDOS screen. Now you have to look into his
html background...:)

Eliyahu

"Juan T. Llibre" <no***********@nowhere.com> wrote in message
news:u%****************@TK2MSFTNGP10.phx.gbl...
I never would have figured you for an HTML
green background color user, Eliyahu.

;-)

Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message
news:ej***************@TK2MSFTNGP09.phx.gbl...
Jerry,

Sure you can set the src on the client. The image control will get another image and render it, no problem.

Eliyahu

"Jerry Camel" <rl*****@msn.com> wrote in message
news:Og**************@TK2MSFTNGP14.phx.gbl...
I am interacting with an OCX on the client side. In the Onload event of the page, I am checking a property of the OCX: Is the port open or closed.

If the port is open, I want a certain image to appear. If the port is closed, a different image.
Sounds pretty straight forward.

Since this is dependent upon a property of a client side component, I can't do this with VB .net on the server, right?

So I was trying to use vbscript on the client like this:

If Form1.CardReader.PortOpen = True Then
Document.getElementById("lblPortStatus").innerText = "Card reader is active." Document.getElementById("imgStatus").setAttribute( "src", "images/CR_On.jpg") Else
Document.getElementById("lblPortStatus").innerText = "Card reader is NOT active." Document.getElementById("imgStatus").setAttribute( "src","images/CR_Off.jpg") End If

What I've kinda figured out is that I can't really just change the src text 'cause I'm already at the client. So how do I have the images "cached" so that I can change the src dynamically? Or am I completely misunderstanding the problem?

Any help is appreciated. Thanks.

Jerry

Nov 19 '05 #5
After all, the problem wasn't my code... Just where I had it in the document. Thanks for the input.
"Eliyahu Goldin" <re*************@monarchmed.com> wrote in message news:ej***************@TK2MSFTNGP09.phx.gbl...
Jerry,

Sure you can set the src on the client. The image control will get another image and render it, no problem.

Eliyahu

"Jerry Camel" <rl*****@msn.com> wrote in message news:Og**************@TK2MSFTNGP14.phx.gbl...
I am interacting with an OCX on the client side. In the Onload event of the page, I am checking a property of the OCX: Is the port open or closed.

If the port is open, I want a certain image to appear. If the port is closed, a different image.
Sounds pretty straight forward.

Since this is dependent upon a property of a client side component, I can't do this with VB .net on the server, right?

So I was trying to use vbscript on the client like this:

If Form1.CardReader.PortOpen = True Then
Document.getElementById("lblPortStatus").innerText = "Card reader is active."
Document.getElementById("imgStatus").setAttribute( "src", "images/CR_On.jpg")
Else
Document.getElementById("lblPortStatus").innerText = "Card reader is NOT active."
Document.getElementById("imgStatus").setAttribute( "src","images/CR_Off.jpg")
End If

What I've kinda figured out is that I can't really just change the src text 'cause I'm already at the client. So how do I have the images "cached" so that I can change the src dynamically? Or am I completely misunderstanding the problem?

Any help is appreciated. Thanks.

Jerry
Nov 19 '05 #6

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

Similar topics

1
by: C A Upsdell | last post by:
I have a site where I am setting a style dynamically, using the JS statement: obj.style.backgroundImage = 'url(img/bak_page.jpg)'; where 'obj' is either document.getElementById(id), or...
9
by: pablo | last post by:
Dear NGers, I would like to change the alt-text with the changing of the image during a mouseover action. Can document.images.altView be changed dynamically? TIA, pablo
3
by: SGA Smele | last post by:
Hello, Now I think that there is a simple answer to my problem, but I don't know what it is and I can't work out what I should be searching for on the internet to read up some more about it. ...
2
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
4
by: Chris Mahoney | last post by:
Hi Currently I am setting the background image of my page by using the following code: <style type="text/css"> BODY { BACKGROUND-IMAGE: url(myimage.jpg) } </style> What I would like to do...
1
by: BryanM | last post by:
I have an asp.net site that uses a dropdown listbox to select 1 of 6 different images to be displayed at one time. Changing the image is working fine. But I need to define and use a different set of...
0
by: =?Utf-8?B?SlA=?= | last post by:
I’m working on a C# ASP application in which they want to give the users the ability to pic their color themes. Each theme has its own folder and the images for each theme are named the same So...
6
by: -Lost | last post by:
Anyone know offhand how to center a text within the bounding box of an image (width-wise at least) without the Freetype library? GD- or ImageMagick-specifc code would do nicely. -- -Lost...
7
by: petethebloke | last post by:
Can anyone help? I have a client who has made a "dynamic interactive map" of our city using Dreamweaver. Each map file has hotspots that pop-up a div with a little image when the mouse goes over...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
3
SueHopson
by: SueHopson | last post by:
Hi All, I'm trying to create a single code (run off a button that calls the Private Sub) for our parts list report that will allow the user to filter by either/both PartVendor and PartType. On...

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.