Hello,

I'm trying to display a picture on my web page without using his path...

Actually, my code can get back the image with:
HTML Code:
<span onclick="document.getElementById('rep').innerHTML=imgHtml(document.myApplet.getString());">Click</span>
	<script type="text/javascript">
	function imgHtml(imgsrc) { return "<img src=\""+imgsrc+"\">"; }
	function imgHtml2(imgsrc2) { return "<img src=\""+imgsrc2+"\">"; }
	function textehtml(texte) { return texte }
	</script>
But don't work on local uses...

How can I display on my web page my image without clicking et without his path ?

Here my full code:
HTML Code:
<html>
<head>
</head>

<body bgcolor="#ffffff">

<applet codebase="./" code="test2.class" archive="test2.jar" name="myApplet" width="300" height="300" MAYSCRIPT="TRUE"></applet>
    
	<span onclick="document.getElementById('rep').innerHTML=imgHtml(document.myApplet.getString());">Click</span>
	<span onclick="document.getElementById('rep2').innerHTML=(document.myApplet.getString());">Rep</span>
	<span onclick="document.getElementById('rep3').innerHTML=imgHtml2('file:///c:/html.jpg');">Test</span>
	<span onclick="document.getElementById('rep4').innerHTML=textehtml('test');">Test</span>
	<div id="rep"></div>
	<div id="rep2"></div>
	<div id="rep3"></div>
	<div id="rep4"></div>
		
	<script type="text/javascript">
	function imgHtml(imgsrc) { return "<img src=\""+imgsrc+"\">"; }
	function imgHtml2(imgsrc2) { return "<img src=\""+imgsrc2+"\">"; }
	function textehtml(texte) { return texte }
	</script>
</body>
</html>
Code:
import java.applet.*;
import java.awt.*;
import java.util.*;
import java.lang.*;
import java.text.*;
import java.awt.event.*; 
import java.io.*;
import javax.swing.*;
import java.net.URLDecoder;
import javax.swing.JLabel;
import netscape.javascript.JSException;
import netscape.javascript.JSObject;



public class test2 extends Applet {
     String sFileName; 
     ImageIcon icon;
     Image img;
     String sjsFileName;
     String sjsFilePath;
     private JLabel label = new JLabel();
     private JSObject jso;
     

    public test2() {
        Panel p = new Panel();
        Font f;
        String osname = System.getProperty("os.name","");
        if (!osname.startsWith("Windows")) {
            f = new Font("Arial",Font.BOLD,10);
        } else {
            f = new Font("Verdana",Font.BOLD,12);
        }
        p.setFont(f);
        p.add(new Button("Parcourir"));
        
        
        p.setBackground(new Color(255, 255, 255));
        
        add("North",p);
   }          
    
    public boolean action(Event evt, Object arg) {
        if (arg.equals("Parcourir")) {
            System.out.println("OPEN CLICKED");
            // cette méthode fonctionne
            Frame parent = new Frame();
            FileDialog fd = new FileDialog(parent, "Répertoire de l'image:", FileDialog.LOAD);
            fd.show();
            String selectedItem = fd.getFile();
            if (selectedItem == null) {
                // no file selected
            } else {
                // read the file
                //System.out.println("reading file " + fd.getDirectory() + File.separator + fd.getFile() );
                sFileName = fd.getDirectory() + File.separator + fd.getFile();

                displayFile(sFileName); 
            }        
        } else return false;
        return true;
    }

    public void paint(Graphics g)
    {
        int width, height;
        
        if (img!=null) {
                width = img.getWidth(this);
                height = img.getHeight(this);
            if (width < height) {
                if (height <= 500)    {
                    g.drawImage(img, 0, 40, this);
                }else {
                    double ratio = 500 / (double) height;
                    double temp2 = width*ratio;
                    int temp = (int) temp2;
                    g.drawImage(img, 0, 40, temp, 500, this);
                }
            } else {
                if (width <= 500)    {
                    g.drawImage(img, 0, 40, this);
                }else {
                    double ratio = 500 / (double) width;
                    double temp2 = height*ratio;
                    int temp = (int) temp2;
                    g.drawImage(img, 0, 40, 500, temp, this);
                }
            }
        }    
    }

    public void displayFile (String sFileName){
        System.out.println("file name : " + sFileName);
        try {
            String slocalFileName = URLDecoder.decode(sFileName, "UTF-8");
            System.out.println("slocalFileName : " + slocalFileName);
            icon = new ImageIcon(slocalFileName);
            img = icon.getImage();
            
            repaint();
        }
        catch (Exception e)
        {
            System.out.println("erreur " + e.toString());
        }
    }

    public String getString() {
        return sFileName;
    }    
}

Regards.