D
DanWeaver
Id like to get a handle on an input box which has the same parent as
the
anchor activating the function...
I have the following HTML:
<div id="Div0">
<a id="A1" onclick="HmmFunc(this);">
<img src="action.gif" />
</a>
<input id="input_one" name="inputbox" />
</div>
<div id="Div1">
<a id="A2" onclick="HmmFunc(this);">
<img src="action.gif" />
</a>
<input id="input_two" name="inputbox" />
</div>
Id like to do the following:
function HmmFunc(ref)
{
var moo = ref.parentNode.id;
var x=document.getElementById(moo).getElementByName('input');
x.value = "newvalue"
}
I cant figure out why I cant search within
a div for a child element with a specified name to get a control.
I can to it as follows but I know the name of the input box I want
within the specified DIV...
function HmmFunc(ref)
{
var moo = ref.parentNode.id;
var x=document.getElementById(moo).getElementsByTagName('input');
x[0].value="newvalue"
}
the
anchor activating the function...
I have the following HTML:
<div id="Div0">
<a id="A1" onclick="HmmFunc(this);">
<img src="action.gif" />
</a>
<input id="input_one" name="inputbox" />
</div>
<div id="Div1">
<a id="A2" onclick="HmmFunc(this);">
<img src="action.gif" />
</a>
<input id="input_two" name="inputbox" />
</div>
Id like to do the following:
function HmmFunc(ref)
{
var moo = ref.parentNode.id;
var x=document.getElementById(moo).getElementByName('input');
x.value = "newvalue"
}
I cant figure out why I cant search within
a div for a child element with a specified name to get a control.
I can to it as follows but I know the name of the input box I want
within the specified DIV...
function HmmFunc(ref)
{
var moo = ref.parentNode.id;
var x=document.getElementById(moo).getElementsByTagName('input');
x[0].value="newvalue"
}