Here's a very basic simple that you should be able to pick apart and
make work for you. Of course, in the onLoad, I would run this, and
then if for any reason you would enable any buttons, just run the function
again.

This will loop through ALL forms on the page and only mark text boxes
as being disabled since they don't need to read checkboxes or buttons, but
you can expand this as you see fit. Watch wrapping:
(the styles are ugly, just used to easily show you which ones are disabled)



<style>
.disabled {background: #000000; color: #FFFFFF;}
.notDisabled {background: #FFFFFF; color: #000000;}
</style>


<script language="javascript">
<!--
 function markDisabled(){
  var objEl = null
  for(var x = 0; x < document.forms.length; x++){
   for(var y = 0; y < document.forms[x].elements.length; y++){
    objEl = document.forms[x].elements[y]
    if(objEl.disabled == true && objEl.type == "text"){
     objEl.className = "disabled"
    }
    else if(objEl.type == "text"){
     objEl.className = "notDisabled"
    }
   }
  }

 }
//-->
</script>

<body>
<form name="testForm" action="frame1.html">

<input type="text" name="test1" disabled /><br />
<input type="text" name="test2" /><br />
<input type="text" name="test3" disabled /><br />
<input type="text" name="test4" /><br />

<input type="button" onclick="markDisabled()" value="Click Here To Mark
Disabled" />

</form>



Hope that helps,

Chris Tifer
http://www.emailajoke.com


----- Original Message -----
From: "Kuminda Chandimith" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 6:29 AM
Subject: RE: semi OT: Style for Disabled Inputs box


>
> Thanks Shaffira[1] and Sam
>
> I think I'd go ahead with the read-only option of Sam.
>
> But I'd like do some experiments on the Shaffira's solution.
>
> IIRC there is a way That one could bind JavaScript to a CSS right.
> for example I'd make the onblur event as a part of the CSS.
>
> If any one could give me some help/code samples could be really
apprciated.
> (I don't know the syntax.!!)
>
> Thanks
>
> Kuminda
>
> [1] Hmmm!! what a name!! Sounds really cool.. wonder what Country[2] are
you
> from ?
> [2] What country uses  .id domain name ?
>
>
>
> Kuminda Chandimith
> Sr. Technical Consultant
> Ducont.com FZ-LLC
> Tel:  + 971-4-3913000 Ext 237
> Fax: +971-4-3913001
> http://www.ducont.com
>
>
>
> -----Original Message-----
> From: Shaffira Alya Mevia [mailto:[EMAIL PROTECTED]]
> Sent: 21 August 2002 16:50
> To: ActiveServerPages
> Subject: Re: semi OT: Style for Disabled Inputs box
>
>
> maybe you can try like this.
>
> <SCRIPT language=javascript>
> <!--
> function changebk(obj, new_color)
>
>  obj.style.backgroundColor=new_color
> }
> // -->
> </SCRIPT>
>
> <input type="text" name="test" onfocus="changebk(this, '#FFFFFF')"
> onblur="changebk(this, '#EAF7ED')">
>
> ----- Original Message -----
> From: "Kuminda Chandimith" <[EMAIL PROTECTED]>
> To: "ActiveServerPages" <[EMAIL PROTECTED]>
> Sent: Wednesday, August 21, 2002 19:19 PM
> Subject: semi OT: Style for Disabled Inputs box
>
>
> > Hi All
> >
> > We have a set of forms which we used to Add, modify and View  records.
> Based
> > on the operations mode we are controlling the way each form is
Displayed.
> >
> > When it comes to View mode we use a JavaScript to disable all the
fields.
> > Everything works fine except that customer complains that all the
content
> in
> > the input fields not easy to view because of the grey text.
> >
> > One option I have to overcome this is to re-do all the pages to display
> > simple Text instead of the greyed Input. Which is not a very attractive
> > thing considering we have close to 50 pages that need this adjustment.
> >
> > So I am thinking whether its possible to set the Colours of a disabled
> input
> > using java script or CSS. (A tag like HOver: where the display changes
> based
> > on the State of The Input Item.). If so can any one of you advise me how
> to
> > do the same.
> >
> > Best regards
> >
> > Kuminda
> >
> >
> >
> > Kuminda Chandimith
> > Sr. Technical Consultant
> > Ducont.com FZ-LLC
> > Tel:  + 971-4-3913000 Ext 237
> > Fax: +971-4-3913001
> > http://www.ducont.com
> >
> > ---
> > You are currently subscribed to activeserverpages as:
> [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> %%email.unsub%%
> >
>
>
> ---
> You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
> %%email.unsub%%
>
> ---
> You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to