我正在尝试制作一个 jquery 插件,其描述如下。我没有太多使用 jQuery 的经验,所以我真的需要一些帮助。
这是我正在谈论的 Java Applet http://www.inference .phy.cam.ac.uk/dasher/TryJavaDasherNow.html
小程序执行一些操作,结果显示在小程序的文本框中。
考虑当用户单击文本框或文本区域元素时出现的虚拟键盘。
例如:
同样,我希望当用户单击 TextBox/TextArea 元素并经过一些操作后应该出现小程序,小程序文本框中的结果应进入 html 文本元素。
我希望我能够把自己说清楚。请帮助我解决这个问题。我没有使用过 jQuery,但这可以通过使用它来完成。
I am trying to make a jquery plugin for which the description is given below. I haven't had much experience working in jQuery so I really needed some help.
Here is the Java Applet I am talking about http://www.inference.phy.cam.ac.uk/dasher/TryJavaDasherNow.html
The applet does some operation the result is shown in the text box in the applet.
Consider a virtual keyboard which comes up when the user clicks on a text box or a text area element.
For eg:
Similarly, I wanted that the applet should appear when the user clicks on TextBox/TextArea element and after some operations, the result in the applet text box should go into the html text element.
I hope I am able to make myself clear. Please help me regarding this. I haven't been working with jQuery but this can be done with its use.
发布评论
评论(1)
假设您的小程序 ID 为
id="myapplet"
为其指定样式display:hidden
,以便它最初是隐藏的。将其放置在 HTML 中您希望其在用户单击TEXTAERA
或文本INPUT
时出现的位置。然后使用 jQuery,您可以执行
此操作,当您单击
TEXTAREA
或INPUT
时,将显示小程序。更新
根据您下面的评论,如果您想在用户可以拖动它的页面上打开小程序,您可以使用 jQuery 的 UI 对话框功能。阅读更多信息 http://jqueryui.com/demos/dialog/
首先将你的 java 对象放入HTML 文件并将其命名为 applet.html。您的对象上不需要有
display:none
。然后,除了 jQuery 之外,您还可以记住包含 jQuery UI 的 JS 和 CSS 文件。
将其放在您的头脑中
并将其放在关闭 body 标签之前
Assuming your applet id is
id="myapplet"
Give it the styledisplay:hidden
so it's initially hidden. Place it anywhere in your HTML where you want it to appear when user clicks on aTEXTAERA
or textINPUT
.Then with jQuery you can do
This will show the applet when you click
TEXTAREA
orINPUT
.Update
As per your comment below, if you want to open the applet over the page where user can drag it around, you can use jQuery's UI dialog function. Read more at http://jqueryui.com/demos/dialog/
First Put your java object inside an HTML file and name it applet.html. No need to have
display:none
on your object. Then you can doRemember to include the JS and CSS files for jQuery UI in addition to jQuery.
Place this in your head
and place those before closing body tag