p5.js- 将输入类型设置为密码

p5.js- Setting input type to password

这里是相当新的程序员。

我最近一直在尝试使用 p5.js 创建用户名和密码表单。它工作得非常好,至少在我需要将密码字段设为私有(并且看起来像密码字段)之前是这样

我知道 HTML 中有 <input type="password"> 选项,但我想知道如何以某种方式将它合并到我的 p5.js 代码中。

谢谢!

我的代码:

password = createInput();
password.position(70, 265);

回答此类问题的最佳方法是通读 the reference. HerecreateInput() 功能的参考。

createInput([value], [type])

Parameters

value String: default value of the input box type String: type of text, ie text, password etc. Defaults to text

听起来你可能想做这样的事情:

password = createInput('', 'password');

另请注意,您或许可以使用 createElement()attribute() 函数手动构建元素。