Click to See Complete Forum and Search --> : IE6 (ot lower?) array problem


homed
06-10-2003, 09:54 AM
Hi,
i programmed a small script to preview a selected image from a java applet.

The script works fine with NN or Mozilla. With IE6 i always get an error message, "null or no object".

Here the script:

<script language="JavaScript1.2">
<!--
// check for an image in jupload list
function check()
{
var path = document.JUpload.getFileName(1); //returns the name of file 1 in upload list

if(path == null || path == "") //in NN it is null and in IE6 its nothing
{
alert('Please add an image/images for upload.');
}
else
{
document.JUpload.startTransfer('form'); // start the file transfer and parse the fom elements
}
}


//image preview
function preview()
{
var path;
//HERE IS MY PROBLEM
var arr = document.JUpload.getSelectedFiles(); //returns an integer array with all selected file indexes from the upload list. Works fine in NN and in IE6 i get the error message
//HERE ENDS MY PROBLEM

if(arr.length == 0)
{
alert('Please select an image for preview.');
}
else
{
path = document.JUpload.getFileName(arr[0]+1);
path = path.replace('\\', '/') ;
path = 'file:///'+path;
document.form.swap.src = path;
}
}
//-->
</script>


If u are bored, here is a zip containing all u need:
http://213.9.4.68/my_problem.zip

THX for ur answer,
Carsten

Khalid Ali
06-10-2003, 10:59 AM
I am thinking..if you returned a string array from the java applet and converted the array value to a number in js you'll not have this problem.

homed
06-10-2003, 11:43 AM
Sorry khalid, i have not programmed the applet, so i canīt return a string instead of an array.

homed
06-11-2003, 02:49 AM
Hi Dave,
after my script at the top u find a link with the html, the applet and the applet manual.

Here again:
http://213.9.4.68/my_problem.zip (http://213.9.4.68/my_problem.zip)

homed
06-11-2003, 06:50 AM
So Dave hereīs the url:

http://213.9.4.68/jupload/test.htm

homed
06-11-2003, 07:26 AM
Thx for ur help Dave,

alert(document.JUpload.name);
alert(document.applets.JUpload.name);
alert(document.applets["JUpload"].name);

they work all......

So I will contact the applet programmer and ask him, if he could test it on IE....., maybe it is a bug or IE sux :D

CU,
Carsten

Khalid Ali
06-11-2003, 09:02 AM
As I mentioned before,the problem is in datatype conversion.IE is having problem in converting and
array of type "int" to JavaScript "int" type.
Where JavaScript int type os used very loosely in JS as compare to Java.
If the applet returned an array of string type...then you would not have this problem( my good guess).
Yes, you'd need to contact the programmer to find out what exactly is happening.