在canvas元素中输入窗体 [英] Input form inside canvas element
本文介绍了在canvas元素中输入窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道是否有任何方法从用户获取输入,最好是通过javascript在canvas元素中的texbox(或用户可以看到他正在写的任何地方)。
I'm wondering if there was any way to get an input from the user, preferably to a texbox (or anywhere a user can see what he's writting) in a canvas element through javascript.
推荐答案
使用绝对定位将文本框放在canvas元素的顶部。
Position a textbox over the top of the canvas element using absolute positioning.
像:
<div style="position:relative;width:800px;height:800px">
<canvas width="800" height="800"></canvas>
<input type="text" style="position:absolute;left:100px;top:300px;width:600px; etc...." />
</div>
这样,你的相对位置< div>
到你要弹出的东西,我可能还会添加一个模态的背景...
with this you have the relative positioned <div>
to base where your going to pop things up over, I would probably also add a modal backdrop...
希望这有助于-ck
这篇关于在canvas元素中输入窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文