473,513 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New to Javascript and trying to solve a problem

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

Oct 23 '06 #1
2 1493

Guy Noir wrote:
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;" />
The use of the javascript pseudo-protocol is unnecessary and may do
more harm than good.
>
<script language="javascript">
The language attribute is deprecated. Use the type attribute instead:

<script type = "text/javascript">
var obUpDownControl1= getDOMObject("__UpDownControl1_Input");
The error message you have is actually pretty helpful. From the script
that you have given, I do not see a method called getDOMObject()
declared anywhere. Define this method and all should be well. Or
perhaps you meant the getElementById() method instead?

Oct 23 '06 #2
web.dev wrote:
Guy Noir wrote:
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;" />

The use of the javascript pseudo-protocol is unnecessary and may do
more harm than good.

<script language="javascript">

The language attribute is deprecated. Use the type attribute instead:

<script type = "text/javascript">
Thanks for the tip.
>
var obUpDownControl1= getDOMObject("__UpDownControl1_Input");

The error message you have is actually pretty helpful. From the script
that you have given, I do not see a method called getDOMObject()
declared anywhere. Define this method and all should be well. Or
perhaps you meant the getElementById() method instead?
OK. I see what happened here. What is TRYING to be accomplished (And
again this may be "the old way") is that we are trying to get and set
the value of a text box on this form.

I see now that document.getElementById() is working for me. Thanks so
much for the feedback and I did learn something here!
-Guy

Oct 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
5657
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
7
7421
by: Kevin Newman | last post by:
I've been toying with a namespace manager, and wanted to get some input. So what do you think? if (typeof com == 'undefined') var com = {}; if (!com.unFocus) com.unFocus = {}; ...
136
9205
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
1
2349
by: john conwell | last post by:
I'm using the Browser control to display html that my application generates. Some times i want a javascript to run when the html gets displayed in the browser control, and sometimes i dont. Is...
2
7981
by: Erwin Moller | last post by:
Hi group, I have this obscure problem that really needs to be fixed, but I am out of ideas. Because the original script is very big, I'll try to summarize its functionality. Setup: - many...
34
26598
by: electrician | last post by:
Perl has it, Basic has it, Fortran has it. What is so difficult about creating a goto command for JavaScript. Just set up a label and say go to it.
5
2575
by: settyv | last post by:
Hi, Below is the Javascript function that am trying to call from asp:Button control. <script language="javascript"> function ValidateDate(fromDate,toDate) { var fromDate=new Date();
7
37996
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement...
25
5426
by: Oltmans | last post by:
Hi guys, I'm learning JavaScript and I need some puzzles that can make me a better JavaScript programmer. I mean I'm looking out for programming puzzles (e.g. Project Euler or TopCoder) but I'm...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7553
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7120
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5697
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3235
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
466
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.