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
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