The statement document.getElementById('txtDBName').value = 'hosted'; would
fail to produce an outcome if there were no control with that ID found. This
could happen if you are referring to a server control that is within another
server control (e.g. a textbox within a datagrid) where the ClientID would
look like this: datagrid1:txtDBName.
Try always to check if the getElementById function returned a null or an
object, e.g.
var txtBox = document.getElementById('txtDBName');
if (txtBox!=null)
{
txtBox.value = "hosted";
}
else
{
alert("could not find a textbox with id='txtDBName'" );
}
--
HTH,
Phillip Williams
http://www.societopia.net http://www.webswapp.com
"gn" wrote:
I have an asp.net page with client side javascript. In the script I can get
a control and read its properties by using
document.getElementById('txtDBName'). But if I try to set any of the
properties of this control it doesn't work; for example the code line
document.getElementById('txtDBName').value = 'hosted';. Can anyone explain
why this is.
I have other pages where I do the same thing in client javascript and those
pages work fine but on this one page this doesn't work. I have compared
pages and I see no differences in the page that doesn't work and the page
that does work.