JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java 新手區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to postflat modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 Javascript 呼叫 JApplet function
magicgro





發文: 46
積分: 0
於 2008-05-05 17:46 user profilesend a private message to usersend email to magicgroreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
小弟我設計一個小程式 經由Javascript呼叫JApplet的method以及使用屬性。其中,屬性的存取沒有問題,可是method的存取卻無法通過,顯示的錯誤為"物件不支援此屬性或方法"。JApplet程式如下所示。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
public class FileCreate extends JApplet {
 
  private JPanel jContentPane = null;
  public String host = "";//host ip address  //  @jve:decl-index=0:
  public String downloadInfor = "";//Dwonload List and Account  //  @jve:decl-index=0:
  /**
   * This is the xxx default constructor
   */
  public FileCreate() {
    super();
  }
 
  /**
   * This method initializes this
   * 
   * @return void
   */
  public void init() {
    this.setSize(300, 200);
    this.setContentPane(getJContentPane());
    host = getParameter("Host");
  }
  
  public String returnStr() {
    return host;
  }
  
  //Save Download Information
  public void saveInfor() {
    String saveData = "";
    BufferedOutputStream bos = null;
    
    saveData += host+"*sp*";
    saveData += downloadInfor;
    
    try {
      bos = new BufferedOutputStream(new FileOutputStream("c:/DownloadList/"+getFileNameFromDate()));
      bos.write(saveData.getBytes());
      bos.close();
    }catch(IOException ioe) {
      //沒有資料夾,新建一個。
      File f = new File("c:/DownloadList/");
      f.mkdir();
      
      //重新存檔
      try {
                                                                bos = new BufferedOutputStream(new FileOutputStream("c:/DCRSDownload/"+getFileNameFromDate()));
        bos.write(saveData.getBytes());
        bos.close();
      }catch(IOException iioe) {}
      
    }
  }
 
}


Html中的Javascript如下:
1
2
3
4
5
6
7
8
9
10
11
12
<script language="JavaScript">
  document.write("<applet name='download_infor' code=FileCreate.class ARCHIVE ='DownloadInfor.jar' width='0' height='0'>");
  document.write("<param name=Host value='"+window.location.host+"'>");
  document.write("</applet>");
  
  //©I¥sJApplet«Ø¥ß¤U¸ü¸ê°T
  function Create_DownloadInfo(DInfor) {    
    document.download_infor.downloadInfor = DInfor;
    alert(document.download_infor.downloadInfor);
    alert(document.download_infor.getFileNameFromDate());
  };
</script>


請各位Java同好不吝賜教...。


reply to postreply to post
話題樹型展開
人氣 標題 作者 字數 發文時間
2396 Javascript 呼叫 JApplet function magicgro 2021 2008-05-05 17:46
2065 Re:Javascript 呼叫 JApplet function honeyaaa 115 2008-05-06 00:53
1934 Re:Javascript 呼叫 JApplet function magicgro 50 2008-05-06 09:07
1970 Re:Javascript 呼叫 JApplet function honeyaaa 22 2008-05-06 12:18
1934 Re:Javascript 呼叫 JApplet function fillano 31 2008-05-06 18:19
2205 Re:Javascript 呼叫 JApplet function magicgro 205 2008-05-06 23:27
1873 Re:Javascript 呼叫 JApplet function honeyaaa 308 2008-05-06 23:55
1846 Re:Javascript 呼叫 JApplet function magicgro 134 2008-05-07 00:02
1921 Re:Javascript 呼叫 JApplet function honeyaaa 230 2008-05-07 00:06
1861 Re:Javascript 呼叫 JApplet function magicgro 58 2008-05-07 09:26
» JWorld@TW »  Java 新手區

reply to postflat modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8