I'm just starting with javascript. I tinkered this very simple function, that enables / disables two textboxes when a checkbox is clicked.
VB Code:
<script language="javascript"> <!-- function enableField(tb1, tb2) { with (tb1) { disabled = !document.form1.checkbox.checked } with (tb2) { disabled = !document.form1.checkbox.checked } } //--> </script>
I want to know how can I access the properties of an html object without using the with (attribute) syntax. Basically doing it inline, replacing the name of the object with the attribute I passed to the function.
Instead of:
with (tb2)
{
disabled = !document.form1.checkbox.checked
}
Do:
document.form1.[attribute I passed].disabled = !document.form1.checkbox.checked
How can I construct that dynamic path?
Thank you
HoraShadow




Reply With Quote