Wrox Programmer Forums
|
ASP Forms As of Oct 5, 2005, this forum is now locked. Please use "Classic ASP beginner" at http://p2p.wrox.com/forum.asp?FORUM_ID=54 or "Classic ASP Professional" http://p2p.wrox.com/forum.asp?FORUM_ID=56 instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP Forms section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 21st, 2005, 05:15 AM
Friend of Wrox
 
Join Date: Jan 2005
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 change the style

I have a text box.....

<input type="text" class="input" tabindex="5" name="retdt" maxlength=5 size=13 onfocus="removeYear('retdt')" onblur="return checkdate('/T2AgIBE/html/calendar.html','document.fexp.retdt.value','docume nt.fexp.rettm.value','ret',document.fexp.crdate.va lue,document.fexp.seldate.value,'retdt')" onChange="javascript:this.value=this.value.toUpper Case();">

How do i grey it out (change the style) to background color = grey when it is disabled.

Picco

__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
 
Old January 21st, 2005, 05:24 AM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

I was thinking the textbox would be greyed out automatically if it is disabled!! Isn't it greying it out when you say element.disabled=true?

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 21st, 2005, 05:45 AM
Friend of Wrox
 
Join Date: Jan 2005
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 border greys out, but i wanted the bgcolor to be grey!

 
Old January 21st, 2005, 05:51 AM
Friend of Wrox
 
Join Date: Jan 2005
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

function displayOpenJaw(val){
// alert("in")
    if (val=="openjaw")
    {
     for(i=0;i<document.fexp.oneret.length;i++)
   {
      document.fexp.oneret[i].checked=false
     }
    newtabledata.innerHTML = '<b>From</b>';
    newtabledata2.innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;<b>To</b><br>';
    depapt2.innerHTML = '<input type="text" style="width: 100; height: 20; font-size : 10; background-color:ECECEC;" name="depapt2" value="" onChange="javascript:this.value=this.value.toUpper Case();" tabindex=2>';
    ariapt2.innerHTML = '&nbsp;<input type="text" style="width: 100; height: 20; font-size : 10;" name="ariapt2" value="" onChange="javascript:this.value=this.value.toUpper Case();" tabindex=2>';
    document.fexp.retdtbt.style.visibility="visible"
    document.fexp.rettm.disabled=false;
    document.fexp.retdt.disabled=false;
    }
    else
    {
   document.fexp.openjaw.checked=false
     newtabledata.innerHTML = '';
     newtabledata2.innerHTML = '';
     depapt2.innerHTML = '';
     ariapt2.innerHTML = '';
    }
}
-->
</script>

=============================

depapt2 is the textbox i want to be greyed out....

any ideas?

 
Old January 21st, 2005, 08:52 AM
Friend of Wrox
 
Join Date: Oct 2003
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

When the textbox is disabled,text color will be changed to grey not the backcolor.You can set the background color of the textbox when it is disabled using BackColor="Gray".

 
Old January 21st, 2005, 10:46 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Is this what you want?

<html>
<head>
   <style type="text/css">
      INPUT.Enabled {background-color: #ffffff}
      INPUT.Disabled {background-color: #a9a9a9}
   </style>

<script type="text/javascript">
function getObject(objectId)
{
 if (document.all && !document.getElementById)
 {
    return document.all(objectId)
 }
 else
 {
    return document.getElementById(objectId)
 }
}

function DisableTextBox()
{
 getObject("txtTest").disabled=true;
 getObject("txtTest").className="Disabled";
}

function EnableTextbox()
{
 getObject("txtTest").disabled=false;
 getObject("txtTest").className="Enabled";

}
</script>
</head>

<body>
 <form>
   <input name="txtTest" class="Required" tabindex="2" value="Vadivel">
   <input type="button" value="Editable TextBox" onclick="EnableTextbox()"/>
   <input type="button" value="Disable TextBox" onclick="DisableTextBox()"/>
 </form>
</body>
</html>

Best Regards
Vadivel

MVP ASP/ASP.NET
http://vadivel.thinkingms.com
 
Old January 24th, 2005, 06:16 AM
Friend of Wrox
 
Join Date: Jan 2005
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

this does the trick:

<input type="radio" name="oneret" value="O" onClick="disaridt();displayOpenJaw('oneret'); this.form.retdt.disabled=true; this.form.retdt.style.background='ECECEC';">








Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic change of style rajesh_css Javascript 3 October 10th, 2008 04:45 AM
Change Drop down Border style ismailc XSLT 2 December 10th, 2007 07:25 AM
Change C# application Visual Style niting85 .NET Framework 2.0 0 April 30th, 2007 03:27 AM
change style.backgroundColor the reset all others crmpicco Javascript How-To 2 September 29th, 2005 09:52 AM
Change style attribute of a WebUserControl YiannisF ASP.NET 1.0 and 1.1 Basics 1 July 10th, 2004 02:19 PM





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