|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Javascript and asp.net - TextBox backcolor not changing...click. The backcolor is not getting changed for the textbox. I am seeing an error on page as well. I am using IE and C# with the asp code. function enableExterNameTextBox(obj) { var textbox = ""; textbox = document.getElementById('partnerExternalName'); if(obj.checked) { alert('checked'); textbox.disabled = true; textbox.value = ""; textBox.style.backgroundColor = 'gray'; } else { alert('unchecked'); textbox.disabled = false; textBox.style.backgroundColor = 'white'; } } Any ideas? Thanks, Avanti Well, the code below works for me, but since you didn't provide the full
HTML code, I can't really say much more: <HTML> <HEAD> <SCRIPT> function enableExterNameTextBox(obj) { var tb = document.getElementById("partnerExternalName"); var cb = obj; if(cb.checked) { alert("checked"); tb.disabled = true; tb.value = ""; tb.style.backgroundColor = "#E0E0E0"; } else { alert("unchecked"); tb.disabled = false; tb.style.backgroundColor = "#FFFFFF"; } } </SCRIPT> </HEAD> <BODY> <FORM ID="frmTest"> <INPUT TYPE="Checkbox" ID="chkColor" onClick="enableExterNameTextBox(this)"> <INPUT TYPE="TEXT" ID="partnerExternalName" /> </FORM> </BODY> </HTML> ---------------------------------------------------------------- Show quoteHide quote "avanti" <ava***@gmail.com> wrote in message news:1161723150.488713.219220@m73g2000cwd.googlegroups.com... >i have a following javascript function that gets called on a checkbox > click. The backcolor is not getting changed for the textbox. I am > seeing an error on page as well. I am using IE and C# with the asp > code. > > function enableExterNameTextBox(obj) > { > var textbox = ""; > textbox = document.getElementById('partnerExternalName'); > if(obj.checked) > { > alert('checked'); > textbox.disabled = true; > textbox.value = ""; > textBox.style.backgroundColor = 'gray'; > } > else > { > alert('unchecked'); > textbox.disabled = false; > textBox.style.backgroundColor = 'white'; > } > } > > > Any ideas? > Thanks, > Avanti >
3 step wizard - ignore last step
Can't duplicate ID in subclassed GridView Gridview sorting event - Gridview Datasource always Null .. why??? WebParts & Highend Portals way to make 2 GridViews line up Anyone have APP_LocalResources resx files for the MS controls... My own control - exception in Design view asp:Repeater and asp:Table CustomValidator inside Repeater is ignored javascript and navigateurl |
|||||||||||||||||||||||