Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 4th, 2005, 04:31 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default 'disabled' image (greyed-out)?

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
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old October 4th, 2005, 05:22 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

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 With Quote
  #3 (permalink)  
Old October 4th, 2005, 08:15 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thank vinod, that look great

www.crmpicco.co.uk
Reply With Quote
  #4 (permalink)  
Old October 4th, 2005, 10:58 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

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 With Quote
  #5 (permalink)  
Old October 4th, 2005, 11:03 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

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 With Quote
  #6 (permalink)  
Old October 5th, 2005, 03:07 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks, how easy is it to make a image the same size and structure but grey?

www.crmpicco.co.uk
Reply With Quote
  #7 (permalink)  
Old October 5th, 2005, 05:17 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

is it possible to place an image over the top of another without using absolute positioning?

www.crmpicco.co.uk
Reply With Quote
  #8 (permalink)  
Old October 5th, 2005, 11:39 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Code:
<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.
Code:
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 With Quote
  #9 (permalink)  
Old October 5th, 2005, 11:43 AM
richard.york's Avatar
Wrox Author
Points: 5,506, Level: 31
Points: 5,506, Level: 31 Points: 5,506, Level: 31 Points: 5,506, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,706
Thanks: 0
Thanked 6 Times in 6 Posts
Default

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 With Quote
  #10 (permalink)  
Old October 6th, 2005, 03:51 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

the disabled property seems to work ok, it removes all events from the button

www.crmpicco.co.uk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Menu Item stays greyed out bnsteel BOOK: Beginning Mac OS X Programming 1 January 10th, 2008 02:18 PM
Disabled icons EricJ VB How-To 0 July 12th, 2005 09:51 AM
disabled popup renee_santoscoi Javascript How-To 5 November 11th, 2003 02:20 PM



All times are GMT -4. The time now is 06:30 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.