Hello all. I am new to Javascript but versed in JAva, c#, etc.
I'm running into a problem and I'm hoping someone can point me in the
right direction.
I have 2 images (Up and down arrows) and I'm trying to change the value
of a text box based on if the up or down arrow was pressed. (Spinner
box).
I am getting an error and I'm not quite sure how to go about debugging.
(Can someone suggest aan easy to use debugger?)
The error is: Error: getDOMObject is not defined. I assume the problem
is with one of these 2 lines, and I suspect it's the "State" line:
var obUpDownControl1= getDOMObject("__UpDownControl1_Input");
var ob___UpDownControl1_State=
getDOMObject("__UpDownControl1_State");
Here are the HTML form attributes:
<input type="text" id="__UpDownControl1_Input"
name="__UpDownControl1_Input" height="30px" value="2" />
<img title="Increment value" src="images/UpArrow_10x10.gif"
onclick="javascript:onUpArrowClick_UpDownControl1( );"
style="border-width:0;" />
<img title="Decrement value" src="images/DownArrow_10x10.gif"
onclick="javascript:onDownArrowClick_UpDownControl 1();"
style="border-width:0;" />
And here is the associated javascript:
<script language="javascript">
var obUpDownControl1= getDOMObject("__UpDownControl1_Input");
var ob___UpDownControl1_State=
getDOMObject("__UpDownControl1_State");
var UpDownControl1_MaxVal = 10;
var UpDownControl1_MinVal = 0;
var UpDownControl1_IncVal = 1;
var iobUpDownControl1Val=obUpDownControl1.value;
function onUpArrowClick_UpDownControl1()
{
if (((iobUpDownControl1Val-0) + (UpDownControl1_IncVal+0))<=
UpDownControl1_MaxVal)
{
obUpDownControl1.value =(iobUpDownControl1Val-0) +
(UpDownControl1_IncVal+0);
iobUpDownControl1Val=obUpDownControl1.value;
ob___UpDownControl1_State.value = obUpDownControl1.value;
}
}
function onDownArrowClick_UpDownControl1()
{
if (((iobUpDownControl1Val-0)-(UpDownControl1_IncVal-0))>=
UpDownControl1_MinVal)
{
obUpDownControl1.value
=(iobUpDownControl1Val-0)-(UpDownControl1_IncVal-0);
ob___UpDownControl1_State.value = obUpDownControl1.value;
iobUpDownControl1Val=obUpDownControl1.value;
}
}
function getControlValue_UpDownControl1(strVal)
{
var iVal = __UpDownControl1_Input.value;
return parseInt(iVal, 10);
}
</script>
Any help or if you could point me in the right direction would be most
excellent.
TIA
-Guy