gpt4 book ai didi

javascript - 我想通过单击按钮将小程序的任何参数发送到浏览器。 (网页)

转载 作者:行者123 更新时间:2023-12-03 06:45:35 24 4
gpt4 key购买 nike

我想通过单击按钮将小程序的任何参数发送到浏览器。 (HTML)。我知道按钮对象有一些方法,但不知道使用哪个。我怎样才能做到这一点?ps .: 我使用的是 jnlp 协议(protocol)。

类似于:

 key_button = new Button("Click"); 
key_button.setBounds(150,50,100,20);
add(key_button);

我有一个小程序代码代码如下:

package applet;

import java.awt.*;
import java.applet.*;
import java.awt.event.*;
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
//import java.io.BufferedWriter;
//import java.io.FileWriter;

public class UserInput extends Applet implements ActionListener{


TextField key_text1;
static TextField key_text2;
TextField key_output;
Label key_label1,key_label2,key_label3;
Button key_button;

public void init(){
setLayout(null);

// Add different components to the layout.


key_label1 = new Label("Enterpassword1: ");
key_label1.setBounds(20,20,100,20);
add(key_label1);

key_text1 = new TextField(5);
key_text1.setBounds(150,20,100,20);
add(key_text1);


key_button = new Button("Click");
key_button.setBounds(150,50,100,20);


/*******************Here I need to create a method that clicking key_button sends the data entered in the TextField field to the website (html) and html would appear the argument entered the applet TextFiel.**************************/


// key_button.event();

add(key_button);

}

最佳答案

..send with a click of the button an applet any parameters to the browser.

String value = textField.getText();
String path = "the.html";
URL url = new URL(getDocumentBase(), path + "?param=" + value);
getAppletContext().showDocument(url);

关于javascript - 我想通过单击按钮将小程序的任何参数发送到浏览器。 (网页),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37750978/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com