Subject: 'disabled' image (greyed-out)?
Posted By: crmpicco Post Date: 10/4/2005 4:31:18 AM
Is there a property to the <img> tag that will allow it to be disabled until a condition is met in the JavaScript? i.e. after a textbox has been filled in the script?

TIA.
Picco

www.crmpicco.co.uk
Reply By: vinod_yadav1919 Reply Date: 10/4/2005 5:22:13 AM
HI Crmpicco!!

<script>
function check()
{
if(document.myform.mytxt!="")
 {
document.myform.img1.disabled=false;
 }
}
</script>
<form name=myform method=get action="abc.html">
<img src="go_login1.gif" name=img1 height=100 width=100 disabled onclick="alert('hi')">
<input type=text name=mytxt onchange="check()">
<br>
<br>
<img src="go_login1.gif" height=100 width=100 onclick="alert('hi')">
</form>

Hope this will help you


Cheers :)

vinod
Reply By: crmpicco Reply Date: 10/4/2005 8:15:55 AM
thank vinod, that look great

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 10/4/2005 10:58:30 AM
hi again vinod, i added the disabled attribute to the <img> tag but it doesnt turn it grey (however it doesn disable it). I suppose i would be able to create a 'grey' image and put some opacity setting on it.

Although, is there a way to make it APPEAR disabled (i.e. grey it out?) like a disabled select drop down?

Thanks

www.crmpicco.co.uk
Reply By: richard.york Reply Date: 10/4/2005 11:03:45 AM
You want to use <input type='image' src='' />

I don't know what an image input does when disabled, but it wouldn't be too difficult to swap the image for the disabled state, just add a different image when disabled.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: crmpicco Reply Date: 10/5/2005 3:07:19 AM
thanks, how easy is it to make a image the same size and structure but grey?

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 10/5/2005 5:17:28 AM
is it possible to place an image over the top of another without using absolute positioning?

www.crmpicco.co.uk
Reply By: crmpicco Reply Date: 10/5/2005 11:39:35 AM

<style>
.opaque { filter: alpha(opacity=25); -moz-opacity:0.23; opacity=0.25 } 
</style>

<img src="images/info_white.gif" id="adt_info1" class="opaque" />

This code works for those that are interested.

function enableImg()
{
    var noa = window.opener.document.form.noa.value;
    var noc = window.opener.document.form.noc.value;
    
    for(a=1; a<=noa; a++)
    {
        var img = window.opener.document.getElementById("adt_info"+a);
        img.className = "deopaque";
        img.title = "";
        
        img.enablement = "disabled";
        img.disabled = false;        
    }

    for(c=1; c<=noc; c++)
    {
        var ch_img = window.opener.document.getElementById("chd_info"+c);
        ch_img.className = "deopaque";
        ch_img.title = "";
        
        ch_img.enablement = "disabled";
        ch_img.disabled = false;        
    }
}

i called the above function to make it enabled again.

www.crmpicco.co.uk
Reply By: richard.york Reply Date: 10/5/2005 11:43:07 AM
Err, an <img /> element does not have a disabled property.  If you want to use the disabled property on an image, use an image input.

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Reply By: crmpicco Reply Date: 10/6/2005 3:51:24 AM
the disabled property seems to work ok, it removes all events from the button

www.crmpicco.co.uk

Go to topic 34770

Return to index page 459
Return to index page 458
Return to index page 457
Return to index page 456
Return to index page 455
Return to index page 454
Return to index page 453
Return to index page 452
Return to index page 451
Return to index page 450