View Full Version : 'grey out' or 'disable' an image
crmpicco
04-12-2005, 03:45 PM
Is there a way to 'grey out' or 'disable' an image?
For example i have this code:
<tr>
<td>
<font face="verdana" size="2" color="#D3D3D3">Status:</font>
</td>
<td>
<img src="picco.jpeg">
</td>
</tr>
How can i 'grey-out' the image picco.jpeg, or have it appear to be 'disabled' like the text???
Picco
Roelf
04-12-2005, 03:51 PM
make a second image, based on the first. Change the appearance of the second image as you desire. Then use javascript to switch the images at the event you choose
But why is this question in this asp forum???
crmpicco
04-12-2005, 04:05 PM
Maybe disabling the <div> tags or something like that:
http://www.forum4designers.com/archive22-2004-3-64683.html
Can that be done is some way?
With Javascript? ASP?
<div id="crm" disabled>
<img src="banner_vr.gif">
</div>
The problem is the img changes EVERY time, so i need it to be dynamic. I cant physically change every image to greyscale, save it etc...
NancyJ
04-12-2005, 04:07 PM
But why is this question in this asp forum???
Presumably he wishes to disable the image based on a condition in an asp script rather than a javascript event.
<%if (condition) then %>
<img src = "picco.jpeg">
<%else%>
<img src = "picco_grey.jpeg">
<%end if %>
crmpicco
04-12-2005, 04:17 PM
yes i do want it to only occur under a condition, but i would kind of need it to be done with HTML, Javascript, ASP or whatever.
I think it can be done with ASP.NET, but I have yet to see it be done anywhere on the WWW with Classic ASP.
Thanks for all your help guys, have you got any other ideas?
Can it be done with javascript?
I found this page, but dont really know what the guy is trying to say:
---------------------------------------------
> <div id=s1 disabled>
> <button onclick="alert('1')">click me</button>
> <button onclick="alert('2')">click me</button>
> <button onclick="alert('3')">click me</button>
> </div>
>
> When I open this code in IE6 the buttons indeed appear grayed out
> (disabled), but surprisingly - they do respond to clicks, despite
> MSDN's explicit declaration...
That won't work in any browser other than IE. It's also invalid HTML.
> Does anybody know how can I still control the buttons state or
> enable/disable their mouse events in one command?
Use your original HTML and:
if( !document.getElementById ) {
if( document.all ) {
document.getElementById = function( id ) {
return document.all[ id ];
}
} else {
document.getElementById = function() {
return null;
}
}
}
function enableGroup( prefix, num, bool ) {
bool = bool || true;
for( var i = 1, e; i <= num; ++i ) {
e = document.getElementById( prefix + num );
if( e ) e.disabled = !bool;
}
}
calling the function
enableGroup( 'b', 3 )
or
enableGroup( 'b', 3, true )
to enable b1 through b3 and
enableGroup( 'b', 3, false )
to disable b1 through b3.
------------------------------------------
I have this setup:
<% if crm = true then %>
<div id="crm" disabled>
<img src="banner_vr.gif">
</div>
<% end if %>
But, i would like the image disabled or greyed-out if the ASP conditon is met as you mentioned. But as i say there are many images and this image will change every time (like eBay for example).
http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&Item=7146893275&Category=62136
(the image in left hand corner)
Any help is greatly appreciated!
crmpicco
04-12-2005, 04:58 PM
What else do i need for this to work?
http://www.tonec.com/products/acim/samples/s17.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<%
Dim im
Set im = CreateObject("ActiveImage.Images.1")
im.SetImageType 1
im.ReadFromFile "c:\banner_vr.gif"
im.ConvertToGrayScale
im.WriteToFile "c:\banner_vr_grey.jpg"
im.DestroyImage
Set im = Nothing
%>
</body>
</html>
glenngv
04-13-2005, 11:36 AM
What else do i need for this to work?
You need to purchase (http://www.tonec.com/products/acim/download.html) and then install it on the server.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.