473,396 Members | 1,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

integers and arrays in Java - how?

I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math on.
So far, i can do math on the values "read" and that result goes into
a "variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything
- even those where i do no calculation.
2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup;
W(CalcFromX) and P(CalcFromX) would be the resulting values to be
displayed on the screen somewhere.

Can this be done, and eXactly how?
Mar 30 '06 #1
36 1997

Robert Baer wrote:
I used Google and found some references for integer in Java.
This newsgroup is about JavaScript, not Java. The two have little more
in common than cars and carpets.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.


How are you trying to read the coordinates? It sounds like you are
trying to write JavaScript using Java documentation. Recognise the
distinction between the languages and you should find it much easier to
find the documentation you need.

--
David Dorward
http://dorward.me.uk/

Mar 30 '06 #2
Robert Baer wrote:
I used Google and found some references for integer in Java.
JavaScript is not Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
There is no 'int' type in JavaScript. Variables are typeless, their values
have types. Reading mouse co-ordinates is done by accessing the properties
of a mouse event. You can read about events at Quirksmode:

<URL:http://www.quirksmode.org/js/introevents.html>

What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math
on.
If you are looking for the co-ordinates of a mouse click, try this from
Quirksmode:

function doSomething(e)
{
var posx = 0;
var posy = 0;
if (!e) var e = window.event;

// W3C compliant browsers
if (e.pageX || e.pageY) {
posx = e.pageX;
posy = e.pageY;

// MS IE compliant version
} else if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;
}
// posx and posy contain the mouse position relative to the document
// Do something with this information
}
Call it from a body click event:

<body onclick="doSomething(event);">

So far, i can do math on the values "read" and that result goes into a
"variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything -
even those where i do no calculation.
Without seeing the code, it is impossible to say what is going on.

2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup;
W(CalcFromX) and P(CalcFromX) would be the resulting values to be
displayed on the screen somewhere.

Can this be done, and eXactly how?


<title>Click coords</title>
<style type="text/css">
#xx {width: 100%; height: 100%;}
</style>

<script type="text/javascript">

function clickCoords(e)
{
var coords = {x:0, y:0};

if (e.pageX || e.pageY) {
coords = {x: e.pageX, y: e.pageY};
} else if (e.clientX || e.clientY) {
coords = {x: e.clientX + document.body.scrollLeft,
y: e.clientY + document.body.scrollTop};
}
return coords;
}

function showClickXY(e)
{
var e = e || window.event
var coords = clickCoords(e);
document.getElementById('xx').innerHTML = coords.x + ', ' + coords.y;
}

</script>
<body onclick="showClickXY(event);">

<div>Click coords: <span id="xx"></span></div>
</body>
In the above example, the coordinates of the mouse click are passed to an
object called 'coords' with properties x and y whose values are set to the
location of the mouse click.
--
Rob
Mar 30 '06 #3
RobG wrote:
Robert Baer wrote:
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.


There is no 'int' type in JavaScript. Variables are typeless, their
values have types.


Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a browser
yet.
PointedEars
Mar 30 '06 #4
Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:
RobG wrote:
Robert Baer wrote:
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.

There is no 'int' type in JavaScript. Variables are typeless, their
values have types.


Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a browser
yet.


And as such, even mentioning it is useless other than a waste of
bandwidth and time for anybody who reads it.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 30 '06 #5
David Dorward wrote:
Robert Baer wrote:
I used Google and found some references for integer in Java.

This newsgroup is about JavaScript, not Java. The two have little more
in common than cars and carpets.

But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.

How are you trying to read the coordinates? It sounds like you are
trying to write JavaScript using Java documentation. Recognise the
distinction between the languages and you should find it much easier to
find the documentation you need.

I am adding Java in HTML to do things that HTML apparently cannot do.
Will get the code i have been working with (in another OS on a
different drive) and post it.
Mar 31 '06 #6
RobG wrote:
Robert Baer wrote:
I used Google and found some references for integer in Java.

JavaScript is not Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.

There is no 'int' type in JavaScript. Variables are typeless, their
values have types. Reading mouse co-ordinates is done by accessing the
properties of a mouse event. You can read about events at Quirksmode:

<URL:http://www.quirksmode.org/js/introevents.html>

What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real
math on.

If you are looking for the co-ordinates of a mouse click, try this from
Quirksmode:

function doSomething(e)
{
var posx = 0;
var posy = 0;
if (!e) var e = window.event;

// W3C compliant browsers
if (e.pageX || e.pageY) {
posx = e.pageX;
posy = e.pageY;

// MS IE compliant version
} else if (e.clientX || e.clientY) {
posx = e.clientX + document.body.scrollLeft;
posy = e.clientY + document.body.scrollTop;
}
// posx and posy contain the mouse position relative to the document
// Do something with this information
}
Call it from a body click event:

<body onclick="doSomething(event);">

So far, i can do math on the values "read" and that result goes into
a "variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything
- even those where i do no calculation.

Without seeing the code, it is impossible to say what is going on.

2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the
lookup; W(CalcFromX) and P(CalcFromX) would be the resulting values to
be displayed on the screen somewhere.

Can this be done, and eXactly how?

<title>Click coords</title>
<style type="text/css">
#xx {width: 100%; height: 100%;}
</style>

<script type="text/javascript">

function clickCoords(e)
{
var coords = {x:0, y:0};

if (e.pageX || e.pageY) {
coords = {x: e.pageX, y: e.pageY};
} else if (e.clientX || e.clientY) {
coords = {x: e.clientX + document.body.scrollLeft,
y: e.clientY + document.body.scrollTop};
}
return coords;
}

function showClickXY(e)
{
var e = e || window.event
var coords = clickCoords(e);
document.getElementById('xx').innerHTML = coords.x + ', ' + coords.y;
}

</script>
<body onclick="showClickXY(event);">

<div>Click coords: <span id="xx"></span></div>
</body>
In the above example, the coordinates of the mouse click are passed to
an object called 'coords' with properties x and y whose values are set
to the location of the mouse click.

What you have given looks like it may be very useful; i had no idea
that different browsers would have to be treated differently.
I do know that there are webpages that are browser *hostile* (causes
them to hang and requires a power off reset); those &^%#$&#$ pages work
only with InfuriatingExasperator.
Can the Mafia be hired for a hit on M$?
Better yet, can a few good programmers be hired to make an OS like
Windows that accepts all the programs that WinQQ without the bloat and bugs?
The next task would be a decent bug-free browser that follows all of
the standards.
Mar 31 '06 #7
Thomas 'PointedEars' Lahn wrote:
RobG wrote:

Robert Baer wrote:
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.


There is no 'int' type in JavaScript. Variables are typeless, their
values have types.

Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a browser
yet.
PointedEars

-->THAT<-- explains why "int" does not work, and possibly why it
kills the mouse coordinates.
Will get my HTML with Jave code from my othe OS and drive for posting.
Mar 31 '06 #8
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:
RobG wrote:
Robert Baer wrote:

But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.

There is no 'int' type in JavaScript. Variables are typeless, their
values have types.

Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a browser
yet.

And as such, even mentioning it is useless other than a waste of
bandwidth and time for anybody who reads it.

Incorrect; the info explained why i had so much trouble.
Mar 31 '06 #9
Robert Baer said the following on 3/31/2006 6:28 AM:
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:
RobG wrote:

Robert Baer wrote:

> But "int" not only does not work, it also prevents reading X and
> Y coordinates of the mouse.

There is no 'int' type in JavaScript. Variables are typeless, their
values have types.
Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a browser
yet.

And as such, even mentioning it is useless other than a waste of
bandwidth and time for anybody who reads it.

Incorrect; the info explained why i had so much trouble.


You had trouble because you were using, or attempting to use, a feature
that is not part of the language. Not because of a feature that might be
in a future release of the language unless you were reading a draft copy
of JavaScript2.0 in which case you should have known it wasn't in use yet.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Mar 31 '06 #10
VK

Robert Baer wrote:
I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math on.
So far, i can do math on the values "read" and that result goes into
a "variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything
- even those where i do no calculation.
2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup;
W(CalcFromX) and P(CalcFromX) would be the resulting values to be
displayed on the screen somewhere.


Sorry but you are looking like Rad Hat in that dark forest - lost any
coordinates of anything.

Shockwave #1
JavaScript is not Java (despite the equal first syllable). Unlike Java
- JavaScript is a loose typed language with current variable type
interpreted based on the current variable value.

Shockwave #2
JavaScript execution environment (where var c = a+b) is completely
separate from DOM (Document Object Model) where say mouse pointer is
hanging out over x120 y220 where element with id "myStuff" happened to
be located.

Truthfully I am not even sure that your problem is within JavaScript -
because it can be interpreted as a misplaced *Java* question.

If it is not, please narrow your problem description to a particular
language with a possible code stamp / URL/

Mar 31 '06 #11
Robert Baer wrote:
I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math
on.
So far, i can do math on the values "read" and that result goes into a
"variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything -
even those where i do no calculation.
2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup;
W(CalcFromX) and P(CalcFromX) would be the resulting values to be
displayed on the screen somewhere.

Can this be done, and eXactly how? Here is the code i have so far:
<html code starts here; this is altered to help protect some>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<!--
var with "Netscape" makes Netscape happy
adding "int" or "integer" in any way totally kills operation
-->
<SCRIPT LANGUAGE="JavaScript">
<!--
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e){
Xmm = (isNav) ? e.pageX : event.clientX;
Ymm = (isNav) ? e.pageY : event.clientY;
document.dataholder.mmX.value=((Xmm-173)/6.8+1938);
document.dataholder.mmY1.value=Ymm;
document.dataholder.mmY2.value=Xmm;
document.dataholder.mmZ.value=((Xmm-173)/6.8+1938);
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// -->
</SCRIPT>

<body>
<center>
<form name="dataholder">
<table border=1>
<tr>
<td><i>Year(wide)</i></td>
<td><input type="text" size=9 name="mmX" value="0"></td>
<td><i>Year(narrow)</i></td>
<td><input type="number" size=3.8 name="mmX" value="0"></td>
<td><i>Number of wells</i></td>
<td><input type="text" size=5 name="mmY1" value="0"></td>
<td><i>Production BBLs</i></td>
<td><input type="text" size=5 name="mmY2" value="0"></td>
<td><i>Z value</i></td>
<td><input type="text" size=9 name="mmZ" value="0"></td>
</tr>
</table>
</form>
</div>

<!--
This code *used to* work, showing a calculated year in the first 2 boxes; the width
of the second box was made narrow to visually "truncate" the numbers to integer.
I have no idea as to why they no longer work.
I added "Z value" and *that* works (!!). Go figure.
-->

<table align="center">
<tr>
<td align=center>
<center>
<div><i>&copy 2006 Oil 4 Less LLC</i></div>
</center>
</td>
</tr>
</table>

<!-- style and then img src as seperate items makes IE happy; GIF is 90% BMP -->
<div style="position: absolute; height: 316px; width: 697px; top: 100px; left: 20px; "
<style="height: 316px; width: 697px; top: 100px; left: 20px; " >
<img src="Arkansas.gif" alt="" usemap="#AK" style="border-style:none" >
</div>

</body>
</html>

Mar 31 '06 #12
Randy Webb wrote:
Robert Baer said the following on 3/31/2006 6:28 AM:
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:

RobG wrote:

> Robert Baer wrote:
>
>> But "int" not only does not work, it also prevents reading X and
>> Y coordinates of the mouse.
>
>
> There is no 'int' type in JavaScript. Variables are typeless, their
> values have types.

Not quite true. There is an `int' type, and variables can be strictly
typed, in JavaScript 2.0. However, that is not implemented in a
browser
yet.

And as such, even mentioning it is useless other than a waste of
bandwidth and time for anybody who reads it.

Incorrect; the info explained why i had so much trouble.

You had trouble because you were using, or attempting to use, a feature
that is not part of the language. Not because of a feature that might be
in a future release of the language unless you were reading a draft copy
of JavaScript2.0 in which case you should have known it wasn't in use yet.

I had no idea that the "int" "feature" was not a part of the language.
I consider that short-sighted at best and ignorantly stupid.
All languages i have seen or heard of that pretend to do some math
*have* either different numeric variable types, or type conversion
(almost always both).
And that has been the case before the PCs came out (1980)!
Draft copy? You mean that there is some kind of (?readable and
understandable?) document that covers Java?
Would such a thing help me?
Mar 31 '06 #13
VK wrote:
Robert Baer wrote:
I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math on.
So far, i can do math on the values "read" and that result goes into
a "variable" that is useful *only* for display.
If i try "int" in that math, the values are then zero for everything
- even those where i do no calculation.
2) Use the calculated integer values as an index to a table or array.
It is acceptable to use an HTML "table" as the source for the lookup;
W(CalcFromX) and P(CalcFromX) would be the resulting values to be
displayed on the screen somewhere.

Sorry but you are looking like Rad Hat in that dark forest - lost any
coordinates of anything.

Shockwave #1
JavaScript is not Java (despite the equal first syllable). Unlike Java
- JavaScript is a loose typed language with current variable type
interpreted based on the current variable value.

Shockwave #2
JavaScript execution environment (where var c = a+b) is completely
separate from DOM (Document Object Model) where say mouse pointer is
hanging out over x120 y220 where element with id "myStuff" happened to
be located.

Truthfully I am not even sure that your problem is within JavaScript -
because it can be interpreted as a misplaced *Java* question.

If it is not, please narrow your problem description to a particular
language with a possible code stamp / URL/

I have posted a reply that includes the code i am presently trying.
It seems i am using Java Script, inside HTML code in an attempt to do
something.
If anyone has used Excel to create a chart, and then "visits" a dot
or point on that chart, a yellow box shows up giving the value of that
point.
*That* is what i want to do, or an equivalent.
Mar 31 '06 #14
Robert Baer wrote:
Randy Webb wrote:
Robert Baer said the following on 3/31/2006 6:28 AM:
Randy Webb wrote:
Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:
> RobG wrote:
>> There is no 'int' type in JavaScript. Variables are typeless, their
>> values have types.
> Not quite true. There is an `int' type, and variables can be strictly
> typed, in JavaScript 2.0. However, that is not implemented in a
> browser
> yet.
And as such, even mentioning it is useless other than a waste of
bandwidth and time for anybody who reads it.
Incorrect; the info explained why i had so much trouble. You had trouble because you were using, or attempting to use, a feature
that is not part of the language. Not because of a feature that might be
in a future release of the language unless you were reading a draft copy
of JavaScript2.0 in which case you should have known it wasn't in use
yet.


I had no idea that the "int" "feature" was not a part of the language.


AFAIK, it is merely not part of a language version that is implemented _in
Web browsers_. You could have RTFM first, and even if you had not, you
could have read and followed <URL:http://jibbering.com/faq/#FAQ4_43> before
you posted anything.
I consider that short-sighted at best and ignorantly stupid.
You should reconsider that. The dynamic nature of J(ava)Script versions,
and other implementations of ECMAScript Editions 1 to 3, made it possible
that they became such widely supported languages.

See also <URL:http://www.mindview.net/WebLog/log-0025>
All languages i have seen or heard of that pretend to do some math
*have* either different numeric variable types, or type conversion
(almost always both).
J(ava)Script implemented client-side *has* type conversion, both explicit
and implicit.
And that has been the case before the PCs came out (1980)!
Are you trolling, or are you just seeking another opportunity to demonstrate
your incompetence in public? ...
Draft copy? You mean that there is some kind of (?readable and
understandable?) document that covers Java?
.... Oh well, apparently the latter. The first thing you have to understand
is that JavaScript is not Java. That is *beginner's knowledge*, you know.
Would such a thing help me?


If you would develop using a language that implements it, such as
Microsoft JScript.NET (AFAIK server-side only), it certainly would.
PointedEars
Mar 31 '06 #15
Robert Baer wrote:
It seems i am using Java Script, [...]


Yes, it only seems to be so. There is no "Java Script".
See my other followup.
PointedEars
Apr 1 '06 #16
Robert Baer wrote:
[...]
What you have given looks like it may be very useful; i had no idea
that different browsers would have to be treated differently.
The posted code deals with the two most common cases, it should work in
just about any post-version 4 browser with scripting enabled.

I do know that there are webpages that are browser *hostile* (causes
them to hang and requires a power off reset); those &^%#$&#$ pages work
only with InfuriatingExasperator.
In the early days of scripted browsers, MS headed off at 1,000kph to do
their own thing without thinking too clearly - flooding the browser script
environment with everything they could think of - in an attempt to
overwhelm Netscape. It achieved the business outcome they were after at
the expense of everything else. Now we live with that legacy.

Some of the stuff they added is good, some has been standardised and some
is downright garbage. But MS refuse to orphan any of their legacy stuff
and many old pages haven't been updated, so there is a significant inertia
to overcome before the old stuff gets cleaned up.

But that seems to be changing, or at least moving on. No doubt a similar
battle will ensue if Google or someone similar ever deliver a reasonable
on-line web application.

Can the Mafia be hired for a hit on M$?
Why bother? Outside their Windows and Office franchises, they are just
another (very well funded) competitor.

Better yet, can a few good programmers be hired to make an OS like
Windows that accepts all the programs that WinQQ without the bloat and
bugs?
The next task would be a decent bug-free browser that follows all of
the standards.


There are browsers that follow standards much more closely and fully than
IE (most are already ahead of the yet-to-be-officially-released IE 7), but
none that fully and faultlessly implement everything W3C/ECMA. There
likely never will be.
--
Rob
Apr 1 '06 #17
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:

Randy Webb wrote:
Robert Baer said the following on 3/31/2006 6:28 AM:

Randy Webb wrote:

>Thomas 'PointedEars' Lahn said the following on 3/30/2006 12:42 PM:
>
>>RobG wrote:
>>
>>>There is no 'int' type in JavaScript. Variables are typeless, their
>>>values have types.
>>
>>Not quite true. There is an `int' type, and variables can be strictly
>>typed, in JavaScript 2.0. However, that is not implemented in a
>>browser
>>yet.
>
>And as such, even mentioning it is useless other than a waste of
>bandwidth and time for anybody who reads it.

Incorrect; the info explained why i had so much trouble.

You had trouble because you were using, or attempting to use, a feature
that is not part of the language. Not because of a feature that might be
in a future release of the language unless you were reading a draft copy
of JavaScript2.0 in which case you should have known it wasn't in use
yet.
I had no idea that the "int" "feature" was not a part of the language.

AFAIK, it is merely not part of a language version that is implemented _in
Web browsers_. You could have RTFM first, and even if you had not, you
could have read and followed <URL:http://jibbering.com/faq/#FAQ4_43> before
you posted anything.

** ?RTFM? what is that? And how would a complete newbie know where to
look or know anything about that URL?

I consider that short-sighted at best and ignorantly stupid.

You should reconsider that. The dynamic nature of J(ava)Script versions,
and other implementations of ECMAScript Editions 1 to 3, made it possible
that they became such widely supported languages.

See also <URL:http://www.mindview.net/WebLog/log-0025>
All languages i have seen or heard of that pretend to do some math
*have* either different numeric variable types, or type conversion
(almost always both).

J(ava)Script implemented client-side *has* type conversion, both explicit
and implicit.

** Well, i would like to learn about how that can be done.
Any suggestions, since "int" or "integer" does not work?

And that has been the case before the PCs came out (1980)!

Are you trolling, or are you just seeking another opportunity to demonstrate
your incompetence in public? ...

Draft copy? You mean that there is some kind of (?readable and
understandable?) document that covers Java?

... Oh well, apparently the latter. The first thing you have to understand
is that JavaScript is not Java. That is *beginner's knowledge*, you know.

** Well, i *now* know that, but was not aware of the distinction earlier.
Incompetent? Well,concerning Java Script, absolutely *yes*, hence the
dumb questions.

Would such a thing help me?

If you would develop using a language that implements it, such as
Microsoft JScript.NET (AFAIK server-side only), it certainly would.

** Only interested i client side - *unless* - you know that it would be
easier to do a server side implimentation and can tell me how i get
someone's server to do whatever tricks are needed...


PointedEars

Apr 1 '06 #18
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:

It seems i am using Java Script, [...]

Yes, it only seems to be so. There is no "Java Script".
See my other followup.
PointedEars

Well, i am using some kind of Java code of some sort...
And you mentioned Java Script 2.0 so one might conclude that either
it does exist or that someone is a liar somewhere...
Apr 1 '06 #19
RobG wrote:
Robert Baer wrote:
[...]
What you have given looks like it may be very useful; i had no idea
that different browsers would have to be treated differently.

The posted code deals with the two most common cases, it should work in
just about any post-version 4 browser with scripting enabled.

I do know that there are webpages that are browser *hostile* (causes
them to hang and requires a power off reset); those &^%#$&#$ pages
work only with InfuriatingExasperator.

In the early days of scripted browsers, MS headed off at 1,000kph to do
their own thing without thinking too clearly - flooding the browser
script environment with everything they could think of - in an attempt
to overwhelm Netscape. It achieved the business outcome they were after
at the expense of everything else. Now we live with that legacy.

Some of the stuff they added is good, some has been standardised and
some is downright garbage. But MS refuse to orphan any of their legacy
stuff and many old pages haven't been updated, so there is a significant
inertia to overcome before the old stuff gets cleaned up.

But that seems to be changing, or at least moving on. No doubt a
similar battle will ensue if Google or someone similar ever deliver a
reasonable on-line web application.

Can the Mafia be hired for a hit on M$?

Why bother? Outside their Windows and Office franchises, they are just
another (very well funded) competitor.

Better yet, can a few good programmers be hired to make an OS like
Windows that accepts all the programs that WinQQ without the bloat and
bugs?
The next task would be a decent bug-free browser that follows all of
the standards.

There are browsers that follow standards much more closely and fully
than IE (most are already ahead of the yet-to-be-officially-released IE
7), but none that fully and faultlessly implement everything W3C/ECMA.
There likely never will be.

Well, closer implimentation would be nice, but having thousands of
potential customers complaining to each browser-hostile URL owner (and
taking their business elsewhere) would seem to be even better.
Apr 1 '06 #20
Robert Baer <ro********@earthlink.net> writes:
Thomas 'PointedEars' Lahn wrote:
You could have RTFM first, and even if you had not, you could have
read and followed <URL:http://jibbering.com/faq/#FAQ4_43> before
you posted anything.
** ?RTFM? what is that? And how would a complete newbie know where to
** look or know anything about that URL?


This URL is a link to the FAQ of this newsgroup. It is posted twice a
week in the group, so anybody following the group for more than four
days would have been able to see it. Several regualars of the group
also have links to this FAQ in their signatures.
People new to Usenet wouldn't know that you are recommended to follow
a group for at least that long before starting to write, or that
groups often have FAQs. The tradiatiaion way of teaching them this is
to answer their questions by a reference to the FAQ. That's what it
is there for.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Apr 1 '06 #21
Robert Baer wrote:
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:
Randy Webb wrote:
Robert Baer said the following on 3/31/2006 6:28 AM:
You had trouble because you were using, or attempting to use, a feature
that is not part of the language. Not because of a feature that might
be in a future release of the language unless you were reading a draft
copy of JavaScript2.0 in which case you should have known it wasn't in
use yet.
I had no idea that the "int" "feature" was not a part of the language. AFAIK, it is merely not part of a language version that is implemented
_in Web browsers_. You could have RTFM first, and even if you had not,
you could have read and followed <URL:http://jibbering.com/faq/#FAQ4_43>
before you posted anything.

** ?RTFM? what is that?


Read The Fine/F***ing Manual. STFW (Search The Fine/F***ing Web).

Using any prefixes for your replies is unwanted. Attribution lines and
Automatically inserted quotation prefixes ("> ") make it clear what is
your text and what is text quoted by you. Quotation and reply should be
delimited by an empty line to ease reading.
And how would a complete newbie know where to look or know anything about
that URL?


See Lasse's followup.
J(ava)Script implemented client-side *has* type conversion, both explicit
and implicit.

** Well, i would like to learn about how that can be done.
Any suggestions, since "int" or "integer" does not work?


That depends on what you are actually looking for. If it is just typing
values, forget about that in these loosely-typed languages. Any numeric
literal is of type `number' (form control values are string values, so if
you want to do calculation with them, explicit conversion to `number' is
wise).

If it is explicit type conversion, try the unary `+' for all types of
operands, parseInt(...) or parseFloat(...) for string-type operands.
Note that `+' is the most efficient way but not fully backwards compatible,
and that parseInt(...) recognizes prefixes as indicators for a number base
(`0x' for 16; `0' for 8 in some implementations), so you should specify
the base as second operand if you want it to interpret the string in a
certain way. IIRC all of this is described in the FAQ.
... Oh well, apparently the latter. The first thing you have to
understand is that JavaScript is not Java. That is *beginner's
knowledge*, you know.

** Well, i *now* know that, but was not aware of the distinction earlier.
Incompetent? Well,concerning Java Script, absolutely *yes*, hence the
dumb questions.


Read it from my fingertips: *There* *is* *no* "*Java* *Script*"!
Would such a thing help me?


If you would develop using a language that implements it, such as
Microsoft JScript.NET (AFAIK server-side only), it certainly would.


** Only interested i client side - *unless* - you know that it would be
easier to do a server side implimentation and can tell me how i get
someone's server to do whatever tricks are needed...


That depends on what you are actually looking for. There are image maps
that do not need client-side scripting, and submit the pointer coordinates
relative to the image position to the server; that information could be
evaluated with a server-side script. If you don't mean images, server-side
script cannot be of help obtaining that information (but maybe processing
it).
PointedEars
Apr 1 '06 #22
Robert Baer wrote:
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:
It seems i am using Java Script, [...]
Yes, it only seems to be so. There is no "Java Script".
See my other followup.
[...]


Well, i am using some kind of Java code of some sort...


Java is off topic here.

BTW: Signatures are not to be quoted, unless there is an explicit reference
in the reply.
And you mentioned Java Script 2.0
,-[news:19****************@PointedEars.de]
|
| Not quite true. There is an `int' type, and variables can be strictly
| typed, in JavaScript 2.0. However, that is not implemented in a browser
^^^^^^^^^^
| yet.
so one might conclude that either it does exist or that someone is a
liar somewhere...


It does not, and you are.
Score adjusted

PointedEars
Apr 1 '06 #23
Robert Baer said the following on 4/1/2006 4:00 AM:
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:

It seems i am using Java Script, [...]

Yes, it only seems to be so. There is no "Java Script".
See my other followup.
PointedEars

Well, i am using some kind of Java code of some sort...


You are using Javascript, not Java Script, and Thomas was being
childishly immature and pedantic about it.
And you mentioned Java Script 2.0 so one might conclude that either it
does exist or that someone is a liar somewhere...


It exists - in theory.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 1 '06 #24
Thomas 'PointedEars' Lahn said the following on 4/1/2006 7:28 AM:

<snip>
BTW: Signatures are not to be quoted,


Oh but you do not have a "signature" my boy. Do you actually need me to
post references to the numerous articles where you claim that you don't?

Or, is it an improperly delimited signature since it does not start with
dash dash space?

Make up your mind son, you can't have your cake and eat it too.

--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Apr 1 '06 #25
VK

Robert Baer wrote:
Robert Baer wrote:
I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.
OK, you'll be helped if you promise _stop_ calling JavaScript as "Java"
or "Java Script". You don't say "Linux" while talking about Windows, do
you? And you don't say that your browser is called "Inter Net
Ex-Plorer", do you?

So: the language you are trying to use is called JavaScript - 10
characters without space. The variant of this language implemented in
Internet Explorer is called JScript - 7 characters without space.
Collectively it is reffered as "JavaScript/JScript programming". To
save time and space it is often said just "script": "my script doesn't
work" etc. - if it is clear by context what your are talking about
JavaScript/JScript programming.

What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math
on.

You cannot do real math without using additional libraries and highly
resource expensive algorithms. In the normal circumstances you are
limited by machine math which may be identical, close or far away from
the real math - depending on values and operations. This is true for
JavaScript (10 chars no space - remember? ;-) as well as for Java, C,
C++, C# and any other language for PC (Personal Computer). See for
instance:-
<http://www.jibbering.com/faq/#FAQ4_6> and
<http://www.jibbering.com/faq/#FAQ4_7>

The code you posted is adjusted for NN4.x (1998-99) Empires raised and
falled since then :-)

Here is the HTML Strict compliant code for current generation of
browsers. Now if you tell what kind of math do you want to do with
mouse coords, one could suggest a proper way.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html401/strict.dtd">
<html>
<head>
<title>test 024</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
html {
margin: 0px 0px;
padding: 0px 0px}

body {
margin: 10px 10px;
padding: 0px 0px;
font: 1em Verdana, sans-serif;
color: #000000;
background-color: #FFFFFF}

form {
margin: 10px 10px;
padding: 5px 5px;
border: thin outset;
background-color: #EEEEEE}

form fieldset {
margin: 10px 10px;
padding: 10px 10px}

form fieldset legend {
margin: 0px 0px;
padding: 5px 5px;
cursor: default;
font-weight: bold}

form fieldset label {
float: left;
clear: left;
width: 20ex;
margin: 5px 0px;
padding: 0px 0px;
text-align: right}

form fieldset label:first-letter {
text-decoration: underline}

form fieldset input {
float: left;
width: 20ex;
margin: 5px 0px;
padding: auto auto;
font: 1em Verdana, sans-serif}

form fieldset button {
float: left;
margin: auto 5px;
padding: auto auto;
font: 1em Verdana, sans-serif}

form fieldset button:first-letter {
text-decoration: underline}
</style>

<script type="text/javascript">
function init() {
if ('undefined' == typeof mmX) {
mmX = document.forms['frm01'].elements['mmX'];
mmY = document.forms['frm01'].elements['mmY'];
}
W3 = ('undefined' != typeof document.body.addEventListener);
IE = ('undefined' != typeof document.body.attachEvent);
}

function start() {
if (W3) {
document.body.addEventListener('mousemove',showCoo rds,true);
}
else if (IE) {
document.body.attachEvent('onmousemove',showCoords );
}
else {
/*NOP*/
}
}

function stop() {
if (W3) {
document.body.removeEventListener('mousemove',show Coords,true);
}
else if (IE) {
document.body.detachEvent('onmousemove',showCoords );
}
else {
/*NOP*/
}
}

function showCoords(evt) {
var e = evt || event;
mmX.value = e.clientX;
mmY.value = e.clientY;
}

window.onload = init;
</script>

</head>

<body>
<!-- Pretty-print is adjusted to the "phantom nodes" issue -->
<form name="frm01" method="post" action=""
<fieldset><legend>Mouse Coords</legend
<label for="mmX">X Coord:</label
<input type="text" name="mmX" id="mmX" accesskey="x"><br<label for="mmY">Y Coord:</label
<input type="text" name="mmY" id="mmY" accesskey="y"></fieldset
<fieldset><legend>Controls</legend
<button type="button" accesskey="w" onClick="start()">Watch</button
<button type="button" accesskey="u" onClick="stop()">Unwatch</button></fieldset</form>


</body>
</html>

Apr 1 '06 #26
VK wrote:
Robert Baer wrote:

I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.


OK, you'll be helped if you promise _stop_ calling JavaScript as "Java"
or "Java Script". You don't say "Linux" while talking about Windows, do
you? And you don't say that your browser is called "Inter Net
Ex-Plorer", do you?


But I did like his calling it "Infuriating Exasperator"
Apr 3 '06 #27
VK

Tony wrote:
VK wrote:
And you don't say that your browser is called "Inter Net
Ex-Plorer", do you?


But I did like his calling it "Infuriating Exasperator"


In the context of the given topic the OP's source of frustration is not
clear at all. "Exasperator" because it doesn't support NN4 event
handling mechanics? No one modern browser does it including Firefox.

Or because JScript doesn't have strict type declarations like int, long
or float? AFAIK it is common for all current implementations *in use* -
except JScript.NET (JScript 7.0).

Apr 4 '06 #28
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:

Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:

Randy Webb wrote:

>Robert Baer said the following on 3/31/2006 6:28 AM:
>You had trouble because you were using, or attempting to use, a feature
>that is not part of the language. Not because of a feature that might
>be in a future release of the language unless you were reading a draft
>copy of JavaScript2.0 in which case you should have known it wasn't in
>use yet.

I had no idea that the "int" "feature" was not a part of the language.

AFAIK, it is merely not part of a language version that is implemented
_in Web browsers_. You could have RTFM first, and even if you had not,
you could have read and followed <URL:http://jibbering.com/faq/#FAQ4_43>
before you posted anything.


** ?RTFM? what is that?

Read The Fine/F***ing Manual. STFW (Search The Fine/F***ing Web).

Using any prefixes for your replies is unwanted. Attribution lines and
Automatically inserted quotation prefixes ("> ") make it clear what is
your text and what is text quoted by you. Quotation and reply should be
delimited by an empty line to ease reading.

And how would a complete newbie know where to look or know anything about
that URL?

See Lasse's followup.

J(ava)Script implemented client-side *has* type conversion, both explicit
and implicit.


** Well, i would like to learn about how that can be done.
Any suggestions, since "int" or "integer" does not work?

That depends on what you are actually looking for. If it is just typing
values, forget about that in these loosely-typed languages. Any numeric
literal is of type `number' (form control values are string values, so if
you want to do calculation with them, explicit conversion to `number' is
wise).

If it is explicit type conversion, try the unary `+' for all types of
operands, parseInt(...) or parseFloat(...) for string-type operands.
Note that `+' is the most efficient way but not fully backwards compatible,
and that parseInt(...) recognizes prefixes as indicators for a number base
(`0x' for 16; `0' for 8 in some implementations), so you should specify
the base as second operand if you want it to interpret the string in a
certain way. IIRC all of this is described in the FAQ.

... Oh well, apparently the latter. The first thing you have to
understand is that JavaScript is not Java. That is *beginner's
knowledge*, you know.


** Well, i *now* know that, but was not aware of the distinction earlier.
Incompetent? Well,concerning Java Script, absolutely *yes*, hence the
dumb questions.

Read it from my fingertips: *There* *is* *no* "*Java* *Script*"!

Would such a thing help me?

If you would develop using a language that implements it, such as
Microsoft JScript.NET (AFAIK server-side only), it certainly would.


** Only interested i client side - *unless* - you know that it would be
easier to do a server side implimentation and can tell me how i get
someone's server to do whatever tricks are needed...

That depends on what you are actually looking for. There are image maps
that do not need client-side scripting, and submit the pointer coordinates
relative to the image position to the server; that information could be
evaluated with a server-side script. If you don't mean images, server-side
script cannot be of help obtaining that information (but maybe processing
it).
PointedEars

I have tried HTML MAP and it is useful to a small extent; what i
found can only link to another web page OnMouseOver or the like - no
coordinates.
If you know of a syntax or such that will give coordinates, then i
would appreciate learning of such.
Apr 6 '06 #29
Randy Webb wrote:
Robert Baer said the following on 4/1/2006 4:00 AM:
Thomas 'PointedEars' Lahn wrote:
Robert Baer wrote:
It seems i am using Java Script, [...]

Yes, it only seems to be so. There is no "Java Script".
See my other followup.
PointedEars


Well, i am using some kind of Java code of some sort...

You are using Javascript, not Java Script, and Thomas was being
childishly immature and pedantic about it.
And you mentioned Java Script 2.0 so one might conclude that either
it does exist or that someone is a liar somewhere...

It exists - in theory.

Are you saying that there are *three* differing languages, "Java",
"JavaScript" and "Java Script"????
Or are there many similar-sounding languages depending which letter
is capitalized, where there is a space, etc?
Apr 6 '06 #30
VK wrote:
Robert Baer wrote:
Robert Baer wrote:

I used Google and found some references for integer in Java.
But "int" not only does not work, it also prevents reading X and Y
coordinates of the mouse.

OK, you'll be helped if you promise _stop_ calling JavaScript as "Java"
or "Java Script". You don't say "Linux" while talking about Windows, do
you? And you don't say that your browser is called "Inter Net
Ex-Plorer", do you? ** I do not use ImpossiblyExasperator; i *ripped* it out of my OS
kicking and screeming.

So: the language you are trying to use is called JavaScript - 10
characters without space. The variant of this language implemented in
Internet Explorer is called JScript - 7 characters without space.
Collectively it is reffered as "JavaScript/JScript programming". To
save time and space it is often said just "script": "my script doesn't
work" etc. - if it is clear by context what your are talking about
JavaScript/JScript programming. ** Well, that results in the question as to what "variant" will work
with the most browsers - and where i get programming inf concerning that
variant.
Yes, my script has problems - in fact, part of it that did work now
refuses to work, and i did not change it.


What i would like to do:
1) Get X and Y mouse coordinates into a variable that i can do real math
on.

You cannot do real math without using additional libraries and highly
resource expensive algorithms. In the normal circumstances you are
limited by machine math which may be identical, close or far away from
the real math - depending on values and operations. This is true for
JavaScript (10 chars no space - remember? ;-) as well as for Java, C,
C++, C# and any other language for PC (Personal Computer). See for
instance:-
<http://www.jibbering.com/faq/#FAQ4_6> and
<http://www.jibbering.com/faq/#FAQ4_7>

The code you posted is adjusted for NN4.x (1998-99) Empires raised and
falled since then :-)

Here is the HTML Strict compliant code for current generation of
browsers. Now if you tell what kind of math do you want to do with
mouse coords, one could suggest a proper way.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN"
"http://www.w3.org/TR/html401/strict.dtd">
<html>
<head>
<title>test 024</title>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<style type="text/css">
html {
margin: 0px 0px;
padding: 0px 0px}

body {
margin: 10px 10px;
padding: 0px 0px;
font: 1em Verdana, sans-serif;
color: #000000;
background-color: #FFFFFF}

form {
margin: 10px 10px;
padding: 5px 5px;
border: thin outset;
background-color: #EEEEEE}

form fieldset {
margin: 10px 10px;
padding: 10px 10px}

form fieldset legend {
margin: 0px 0px;
padding: 5px 5px;
cursor: default;
font-weight: bold}

form fieldset label {
float: left;
clear: left;
width: 20ex;
margin: 5px 0px;
padding: 0px 0px;
text-align: right}

form fieldset label:first-letter {
text-decoration: underline}

form fieldset input {
float: left;
width: 20ex;
margin: 5px 0px;
padding: auto auto;
font: 1em Verdana, sans-serif}

form fieldset button {
float: left;
margin: auto 5px;
padding: auto auto;
font: 1em Verdana, sans-serif}

form fieldset button:first-letter {
text-decoration: underline}
</style>

<script type="text/javascript">
function init() {
if ('undefined' == typeof mmX) {
mmX = document.forms['frm01'].elements['mmX'];
mmY = document.forms['frm01'].elements['mmY'];
}
W3 = ('undefined' != typeof document.body.addEventListener);
IE = ('undefined' != typeof document.body.attachEvent);
}

function start() {
if (W3) {
document.body.addEventListener('mousemove',showCoo rds,true);
}
else if (IE) {
document.body.attachEvent('onmousemove',showCoords );
}
else {
/*NOP*/
}
}

function stop() {
if (W3) {
document.body.removeEventListener('mousemove',show Coords,true);
}
else if (IE) {
document.body.detachEvent('onmousemove',showCoords );
}
else {
/*NOP*/
}
}

function showCoords(evt) {
var e = evt || event;
mmX.value = e.clientX;
mmY.value = e.clientY;
}

window.onload = init;
</script>

</head>

<body>
<!-- Pretty-print is adjusted to the "phantom nodes" issue -->
<form name="frm01" method="post" action=""
><fieldset><legend>Mouse Coords</legend
><label for="mmX">X Coord:</label
><input type="text" name="mmX" id="mmX"

accesskey="x"><br
><label for="mmY">Y Coord:</label
><input type="text" name="mmY" id="mmY"

accesskey="y"></fieldset
><fieldset><legend>Controls</legend
><button type="button" accesskey="w"

onClick="start()">Watch</button
><button type="button" accesskey="u"

onClick="stop()">Unwatch</button></fieldset
</form>

</body>
</html>

Apr 6 '06 #31
Here is the code i have so far, with comments.
***
<html_would_start_here_but_modified_for_sanity>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<!--
var with "Netscape" makes Netscape happy
adding "int" or "integer" in any way totally kills operation
-->

<SCRIPT LANGUAGE="JavaScript">
<!--
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e){
Xmm = (isNav) ? e.pageX : event.clientX;
Ymm = (isNav) ? e.pageY : event.clientY;
document.dataholder.mmX.value=((Xmm-173)/6.8+1938);
document.dataholder.mmY1.value=Ymm;
document.dataholder.mmY2.value=Xmm;
document.dataholder.mmZ.value=((Xmm-173)/6.8+1938);
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// -->
</SCRIPT>

<body>
<center>
<form name="dataholder">
<table border=1>
<tr>
<td><i>Year(wide)</i></td>
<td><input type="text" size=9 name="mmX" value="0"></td>
<td><i>Year(narrow)</i></td>
<td><input type="number" size=3.8 name="mmX" value="0"></td>
<td><i>Number of wells</i></td>
<td><input type="text" size=5 name="mmY1" value="0"></td>
<td><i>Production BBLs</i></td>
<td><input type="text" size=5 name="mmY2" value="0"></td>
<td><i>Z value</i></td>
<td><input type="text" size=9 name="mmZ" value="0"></td>
</tr>
</table>
</form>
</div>

<!--
This code *used to* work, showing a calculated year in the first 2
boxes; the width
of the second box was made narrow to visually "truncate" the
numbers to integer.
I have no idea as to why they no longer work.
I added "Z value" and *that* works (!!). Go figure.
How can anybody produce working code with that crap happening?
-->

<table align="center">
<tr>
<td align=center>
<center>
<div><i>&copy 2006 Oil 4 Less LLC</i></div>
</center>
</td>
</tr>
</table>

<!-- style and then img src as seperate items makes IE happy -->
<div style="position: absolute; height: 316px; width: 697px; top: 100px;
left: 20px; "
<style="height: 316px; width: 697px; top: 100px; left: 20px; " >
<img src="Arkansas.gif" alt="" usemap="#AK" style="border-style:none" >
</div>

</body>
</html>
***
Please note the problem with the first 2 display boxes ceasing to
work, and tell me what the he77 is going on.
Once i have a (calculated) year, i would like to "look-up" two
"values" (from a table of some sort): number of wells, and production.
Now those "values" may not be strictly numeric - there is the
possibility of entries like "123,456!" or "83,331#" or "3,551" (no
quotes) and i would want to display or show them "as-is".
Since JavaScript is supposed to be typeless, i would assume that is
not a problem.
The array or table will have about 65 years worth of data.
Apr 6 '06 #32
Lee wrote:
Robert Baer said:

<td><input type="text" size=9 name="mmX" value="0"></td>
<td><i>Year(narrow)</i></td>
<td><input type="number" size=3.8 name="mmX" value="0"></td>
<td><i>Number of wells</i></td>

You've got two fields named "mmX". That's not going to work
the way you want. Give one of them a different name and
assign its value separately.

I will certainly try that; thanks.
However, that does not help explain why it used to work.
I wanted to show mmX in two places, and that is what *did* happen
until recently.
And that *certainly* does not explain why mmY does not work.
Apr 7 '06 #33
Robert Baer wrote:
Here is the code i have so far, with comments.
***
<html_would_start_here_but_modified_for_sanity>
<head>
<title>Test page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
</head>

<!--
var with "Netscape" makes Netscape happy
adding "int" or "integer" in any way totally kills operation
-->

<SCRIPT LANGUAGE="JavaScript">
<!--
var isNav = (navigator.appName.indexOf("Netscape") !=-1);
function handlerMM(e){
Xmm = (isNav) ? e.pageX : event.clientX;
Ymm = (isNav) ? e.pageY : event.clientY;
document.dataholder.mmX.value=((Xmm-173)/6.8+1938);
document.dataholder.mmY1.value=Ymm;
document.dataholder.mmY2.value=Xmm;
document.dataholder.mmZ.value=((Xmm-173)/6.8+1938);
}
if (isNav) {
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// -->
</SCRIPT>

<body>
<center>
<form name="dataholder">
<table border=1>
<tr>
<td><i>Year(wide)</i></td>
<td><input type="text" size=9 name="mmX" value="0"></td>
<td><i>Year(narrow)</i></td>
<td><input type="number" size=3.8 name="mmX" value="0"></td>
<td><i>Number of wells</i></td>
<td><input type="text" size=5 name="mmY1" value="0"></td>
<td><i>Production BBLs</i></td>
<td><input type="text" size=5 name="mmY2" value="0"></td>
<td><i>Z value</i></td>
<td><input type="text" size=9 name="mmZ" value="0"></td>
</tr>
</table>
</form>
</div>

<!--
This code *used to* work, showing a calculated year in the first 2
boxes; the width
of the second box was made narrow to visually "truncate" the
numbers to integer.
I have no idea as to why they no longer work.
I added "Z value" and *that* works (!!). Go figure.
How can anybody produce working code with that crap happening?
-->

<table align="center">
<tr>
<td align=center>
<center>
<div><i>&copy 2006 Oil 4 Less LLC</i></div>
</center>
</td>
</tr>
</table>

<!-- style and then img src as seperate items makes IE happy -->
<div style="position: absolute; height: 316px; width: 697px; top: 100px;
left: 20px; "
<style="height: 316px; width: 697px; top: 100px; left: 20px; " >
<img src="Arkansas.gif" alt="" usemap="#AK" style="border-style:none" >
</div>

</body>
</html>
***
Please note the problem with the first 2 display boxes ceasing to
work, and tell me what the he77 is going on.
Once i have a (calculated) year, i would like to "look-up" two
"values" (from a table of some sort): number of wells, and production.
Now those "values" may not be strictly numeric - there is the
possibility of entries like "123,456!" or "83,331#" or "3,551" (no
quotes) and i would want to display or show them "as-is".
Since JavaScript is supposed to be typeless, i would assume that is
not a problem.
The array or table will have about 65 years worth of data.

Using Google to search for JavaScript, i found http://www.w3schools.com
which seems to give JavaScript help.
Looking in their JS Math, i found "Math Object Methods" with cryptic
numbers ?rating? FireFox, Netscape, and IE.
It appears that *none* of the "methods" work.

One would think that Google is giving bad information, and that site
does not cover JavaScript.
Apr 7 '06 #34
Robert Baer said on 07/04/2006 2:04 PM AEST:
[...]
Using Google to search for JavaScript, i found http://www.w3schools.com
which seems to give JavaScript help.
It offers tutorials on a variety of web technologies. Their stuff is OK
but don't treat it as authoritative. It has many eccentricities and is
plain wrong on some things. Use with caution.

Looking in their JS Math, i found "Math Object Methods" with cryptic
numbers ?rating? FireFox, Netscape, and IE.
The Math object is a native, built-in ECMAScript object. The numbers
for each browser provided by w3schools is the version that supported
that particular property/method.

It appears that *none* of the "methods" work.
As far as I know, they all work in modern browsers. Remember that they
are properties/methods of the Math object, so abs() is used thusly:

var x = -5;
alert( Math.abs(x) ); // shows '5'
Similarly for other methods.
One would think that Google is giving bad information, and that site
does not cover JavaScript.


Google is good. Some may agree with your opinion of w3schools, but they
might also be called cynics. ;-)
--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>
Apr 7 '06 #35
RobG wrote:
Robert Baer said on 07/04/2006 2:04 PM AEST:
[...]
Using Google to search for JavaScript, i found http://www.w3schools.com
which seems to give JavaScript help.

It offers tutorials on a variety of web technologies. Their stuff is OK
but don't treat it as authoritative. It has many eccentricities and is
plain wrong on some things. Use with caution.

Looking in their JS Math, i found "Math Object Methods" with cryptic
numbers ?rating? FireFox, Netscape, and IE.

The Math object is a native, built-in ECMAScript object. The numbers
for each browser provided by w3schools is the version that supported
that particular property/method.

It appears that *none* of the "methods" work.

As far as I know, they all work in modern browsers. Remember that they
are properties/methods of the Math object, so abs() is used thusly:

var x = -5;
alert( Math.abs(x) ); // shows '5'
Similarly for other methods.
One would think that Google is giving bad information, and that site
does not cover JavaScript.

Google is good. Some may agree with your opinion of w3schools, but they
might also be called cynics. ;-)

Does that mean one cannot do a simple-minded y = abs(x) ?
Apr 8 '06 #36
Robert Baer said on 08/04/2006 4:49 PM AEST:
RobG wrote:
Robert Baer said on 07/04/2006 2:04 PM AEST: [...]
It appears that *none* of the "methods" work.


As far as I know, they all work in modern browsers. Remember that
they are properties/methods of the Math object, so abs() is used thusly:

var x = -5;
alert( Math.abs(x) ); // shows '5'
Similarly for other methods. [...]

Does that mean one cannot do a simple-minded y = abs(x) ?


Yes. abs is a method of the Maths object. If you have lots of Math
functions to call, you could use 'with' but it's use is generally
frowned upon because it obfuscates code, e.g.:

with (Math){
alert(
abs(-5) + '\n' +
sqrt(5) + '\n' +
pow(3,4)
);
}

--
Rob
Group FAQ: <URL:http://www.jibbering.com/FAQ>
Apr 9 '06 #37

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

Similar topics

12
by: Elijah Bailey | last post by:
I have two char arrays of size k. I want to know which one is bigger (exactly like for instance I compare two ints/longs/etc.). What is the fastest way to do this? k <= 10 usually for my...
16
by: aruna | last post by:
Given a set of integers, how to write a program in C to sort these set of integers using C, given the following conditions a. Do not use arrays b. Do not use any comparison function like if/then...
15
by: Paul Morrison | last post by:
Hi all, I need to come up with some differences between arrays in Java and C, I have searched Google and so far all I have found is the following: Arrays in Java are reference types with...
3
by: John Bend | last post by:
Hello. Can anyone please suggest some good tutorial links where Java Vectors and Arrays are explained and compared? I'm a proficient programmer but fairly new to Java. Whilst I understand...
1
by: Rob Griffiths | last post by:
Can anyone explain to me the difference between an element type and a component type? In the java literature, arrays are said to have component types, whereas collections from the Collections...
17
by: Robert Baer | last post by:
I used Google and found some references for integer in Java. But "int" not only does not work, it also prevents reading X and Y coordinates of the mouse. What i would like to do: 1) Get X and Y...
1
by: susheela s | last post by:
Hi, Im doing a multiplication of two large integers which are store in arrays(such as 2345 is in array as 2 in a, 3 in a and so on)like this im storing integers in two arrays.The logic i have used...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...
0
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.