一个简单的文字字段除了一个矩形框,如何? [英] A simple text field besides a rectangular box , how to ?

查看:83
本文介绍了一个简单的文字字段除了一个矩形框,如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我在想代码:

在文本框内写一些内容,如果输入的单词是相同的英雄例如,它旁边的框将变为绿色表示正确,否则它将变为红色表示错误,如果没有输入则保持白色。

我真的很想知道我们如何使用函数在javascript中编码,没有任何CSS或其他任何东西。

这意味着我们有2个对象,一个文本框和一个矩形用于反馈颜色。
备注:根本没有按钮,验证每次打字时都会这样。


奖金问题:如果有一天我们决定用图片改变颜色,是否可以这样做?

非常感谢你的帮助,非常感谢。

Hi guys,I was thinking about the code to :
write something inside the text box and if the word entered is equal "hero" for example the box next to it will turn green means correct, otherwise it will turn red means wrong,and if nothing entered it stays white.
I really like to know how we code that in javascript using functions, without any CSS or anything else.
That means we have 2 objects a text box and a rectangle for feedback color.
Remark: there is no button at all, the validation will be each time you are typing.


A Bonus question : if someday we decide to change the color with pictures , is it possible to do that?
Thank you very much for your help, much appreciate it.

推荐答案

这是可能的。一个很好的例子是密码强度自定义组件,它根据用户密码长度改变颜色。你可以google它。
This is possible. A good example is the password strength custom component which changes color based on the user password length. You can google it.



没有任何CSS或其他任何东西。
without any CSS or anything else.



为什么让它变得过于复杂?

why making it overly complicated like that?


好的,你可以使用你觉得可以随意的任何东西。
ok you can use whatever you feel conveniable.


这篇关于一个简单的文字字段除了一个矩形框,如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆