473,769 Members | 3,823 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.CardReade r.PortOpen = True Then
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is active."
Document.getEle mentById("imgSt atus").setAttri bute("src", "images/CR_On.jpg")
Else
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is NOT active."
Document.getEle mentById("imgSt atus").setAttri bute("src","ima ges/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 misunderstandin g the problem?

Any help is appreciated. Thanks.

Jerry
Nov 19 '05 #1
5 1910
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("imgSt atus").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.co m> wrote in message news:Og******** ******@TK2MSFTN GP14.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.CardReade r.PortOpen = True Then
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is active."
Document.getEle mentById("imgSt atus").setAttri bute("src", "images/CR_On.jpg")
Else
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is NOT active."
Document.getEle mentById("imgSt atus").setAttri bute("src","ima ges/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 misunderstandin g 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.co m> wrote in message
news:ej******** *******@TK2MSFT NGP09.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.co m> wrote in message
news:Og******** ******@TK2MSFTN GP14.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.CardReade r.PortOpen = True Then
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is active."
Document.getEle mentById("imgSt atus").setAttri bute("src", "images/CR_On.jpg")
Else
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is NOT active."
Document.getEle mentById("imgSt atus").setAttri bute("src","ima ges/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 misunderstandin g 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%******** ********@TK2MSF TNGP10.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.co m> wrote in message
news:ej******** *******@TK2MSFT NGP09.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.co m> wrote in message
news:Og******** ******@TK2MSFTN GP14.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.CardReade r.PortOpen = True Then
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is active." Document.getEle mentById("imgSt atus").setAttri bute("src", "images/CR_On.jpg") Else
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is NOT active." Document.getEle mentById("imgSt atus").setAttri bute("src","ima ges/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 misunderstandin g 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.co m> wrote in message news:ej******** *******@TK2MSFT NGP09.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.co m> wrote in message news:Og******** ******@TK2MSFTN GP14.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.CardReade r.PortOpen = True Then
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is active."
Document.getEle mentById("imgSt atus").setAttri bute("src", "images/CR_On.jpg")
Else
Document.getEle mentById("lblPo rtStatus").inne rText = "Card reader is NOT active."
Document.getEle mentById("imgSt atus").setAttri bute("src","ima ges/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 misunderstandin g 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
2890
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 document.all, depending on browser support. This works just fine, with just one small problem: I want to set the style ONLY for screen media, not for printer media; the above statement appears to
9
3725
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
1222
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. Here is my problem: I have a webpage that shows a graph. The graph is a streamed image from another webpage. This works perfectly, see code below, I have just written some HTML to display the graph.
2
2928
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 a WebForm with some textboxes, dropdownlists, a panel, imagebutton and so on. When I click on the image button (which was created at design time) I dynamically build a table. In each of row of that new table I put several cells and one cell...
4
3786
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 is change the background image dynamically. My guess
1
2397
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 coordinates for each image. One image could have as few as 5 regions, while another could have up to 100. The coordinates will be hardcoded but I can't seem to figure out how to load different sets of "PolygonHotspot" based on which image is...
0
1096
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 that in theory, all I need to do is dynamically change the scr tags of all the non server side images to be the name of the folder. Ex: <image scr=’/images//leftcorner.jpg’/> I’ve been pondering the best solution to make this work and I...
6
4744
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 Remove the extra words to reply by e-mail. Don't e-mail me. I am kidding. No I am not.
7
3648
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 them. They also link to another file. I've converting the application to a PHP-AJAX system at http://www.ilex-urc-maps.com/testing.html but I can't get the dynamically altered hotspots to work. Any ideas? Please don't tell me that the client...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9420
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
9851
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
8863
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
7401
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
5293
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...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
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.