Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16688 > unrolled thread
| Started by | Michele Da Ros <boeszyslak@gmail.com> |
|---|---|
| First post | 2012-10-17 09:12 -0700 |
| Last post | 2012-10-17 13:11 -0700 |
| Articles | 3 — 3 participants |
Back to article view | Back to comp.lang.javascript
function argument type Michele Da Ros <boeszyslak@gmail.com> - 2012-10-17 09:12 -0700
Re: function argument type Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-17 17:39 +0000
Re: function argument type Danny <dann90038@gmail.com> - 2012-10-17 13:11 -0700
| From | Michele Da Ros <boeszyslak@gmail.com> |
|---|---|
| Date | 2012-10-17 09:12 -0700 |
| Subject | function argument type |
| Message-ID | <352fc896-b38a-401b-bdc9-9a342d52a8ed@googlegroups.com> |
hi to all
I'm trying to call an applet method from a js script
this is the code
function jump() {
var x = 1374795;
var y = 5700582;
var z = 170;
document.xnavigator.jumpToCoordinate(x,y,z);
}
the problem is that it works only on some browsers (firefox on Linux)
In other browsers the applet throws an illegalarguments exception, but this version works
function jump() {
var x = 1374795.001;
var y = 5700582.001;
var z = 170.001;
document.xnavigator.jumpToCoordinate(x,y,z);
}
Have you ever had an issue like this? Is there a workaround?
How can I get control about variable's type?
Thank you
[toc] | [next] | [standalone]
| From | Denis McMahon <denismfmcmahon@gmail.com> |
|---|---|
| Date | 2012-10-17 17:39 +0000 |
| Message-ID | <k5mqgd$nnp$1@dont-email.me> |
| In reply to | #16688 |
On Wed, 17 Oct 2012 09:12:07 -0700, Michele Da Ros wrote:
> hi to all I'm trying to call an applet method from a js script
>
> this is the code
>
> function jump() {
> var x = 1374795;
> var y = 5700582;
> var z = 170; document.xnavigator.jumpToCoordinate(x,y,z);
> }
>
> the problem is that it works only on some browsers (firefox on Linux)
> In other browsers the applet throws an illegalarguments exception, but
> this version works
>
> function jump() {
> var x = 1374795.001;
> var y = 5700582.001;
> var z = 170.001; document.xnavigator.jumpToCoordinate(x,y,z);
> }
> Have you ever had an issue like this? Is there a workaround?
> How can I get control about variable's type?
Does the second format work in firefox on linux?
It looks like it may be a problem in the way ints and floats are handled
by or handed to the applet.
If the second format works in all browsers, it may even work as:
function jump() {
var x = 1374795.0;
var y = 5700582.0;
var z = 170.0;
document.xnavigator.jumpToCoordinate(x,y,z);
}
in which case obviously the applet is loking for a float, not an "int or
float", and appending .0 to an int is often sufficient to force the
underlying code to treat it as a float (in many cases just appending "."
is sufficient).
Rgds
Denis McMahon
[toc] | [prev] | [next] | [standalone]
| From | Danny <dann90038@gmail.com> |
|---|---|
| Date | 2012-10-17 13:11 -0700 |
| Message-ID | <8f608e98-9058-48e1-b99d-0863b57030b4@googlegroups.com> |
| In reply to | #16688 |
js wise, the code you have looks fine, there are no 'syntactical' errors from the js standpoint. Bear in mind that js will use whatever object/method is exposed from an embedded element, so long it's given access. Now, your error doesn't seem to be a js one, so much as a Java one, whatever the exposed method is needing as argument, you'll have to check the Java Script itself, or its documentation if any provided.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.javascript
csiph-web