|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
|||
|
|||
|
function MakeReadOnlyBox(form, CBox, Box){
if(form.CBox.checked == true) { form.CBox.checked = true; form.Box.readOnly = !form.Box.readOnly; } if(form.+CBox+.checked == false) { form.+CBox+.checked = false; form.+Box+.readOnly = !form.+Box+.readOnly; } } onClick="MakeReadOnlyBox(this.form,'CBookValue','BookValue' );" Error - this.form.Cbox - Not an Object How do you pass strings to and object in a function.. Sounds weird saying it.. |
|
#2
|
|||
|
|||
|
I would suggest that you use the DOM model. This is much mote browser independed.
Make sure that your checkbox and editbox have an appropriate id assigned to them e.g.: Code:
<input type='input' id='edit_id' readonly='readonly'/> Then the following principle would work Code:
<input type='checkbox' id='check_id' onclick="MakeReadOnlyBox('check_id', 'edit_id');"/>
function MakeReadOnlyBox(CheckID, EditID)
{
// Check the DOM
if(document.getElementById)
{
// Get the elements
el_check = document.getElementById(CheckID);
el_edit = document.getElementById(EditID);
// Check if they were found
if(el_check && el_edit)
{
// Make editbox readonly when not checked
el_edit.readonly = !el_check.checked;
}
}
}
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Function Object passed to object... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|