推荐关注
› Meteor
› JSLint - a JavaScript code quality tool
› jsFiddle
› D3.js
› WebStorm
推荐书目
› JavaScript 权威指南第 5 版
› Closure: The Definitive Guide
BFG

js 怎样获取 input 的值返回对应的数据

  •  
  •   BFG · Jul 31, 2015 · 3240 views
    This topic created in 4099 days ago, the information mentioned may be changed or developed.

    html code :<input type="text"><span>老王</span>
    在input内输入111那么在span内就显示老王
    输入222就显示老张
    输入333就显示老周
    输入其它数字则显示没有对应数值

    请各位帮我看看这段js代码怎么写?

    SilentDepth
        2
    SilentDepth  
       Aug 2, 2015
    就是侦听<input>的事件嘛,根据用户输入修改<span>里的文本。
    随便写了一下,小白,轻拍: https://jsfiddle.net/khLdqeu0/ (图省事引用了jQuery库)

    PS: 一楼什么鬼……
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   3985 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 05:19 · PVG 13:19 · LAX 22:19 · JFK 01:19
    ♥ Do have faith in what you're doing.