代码之家  ›  专栏  ›  技术社区  ›  David

尝试调整dojo工具包“highlight container”

  •  0
  • David  · 技术社区  · 15 年前

    我在dojo工具包中使用“highlight container”效果(作为 shown here )

    当我有一个 div 包含 特克斯塔利亚 而不是文本字段。我不知道如何让它识别文本字段或文本区域。代码函数如下:

    dojo.addOnLoad(function() {
      dojo.query(".container input[type=text]",
      dojo.byId("topLevel"))
    .onfocus(function(evt){
      //Make the background light yellow when an input gets focus
        dojo.anim(getContainer(evt.target),{backgroundColor: "#FFFFCC"});
      })
    .onblur(function(evt){
      //Restore the background when an input loses focus
        dojo.anim(getContainer(evt.target), {backgroundColor: "#FFFF66"});
      }) 
    

    (});

    如您所见,这是找到文本字段的第二行。我想寻找文本区域也会去那里,但我不知道语法。

    谢谢你的帮助!

    1 回复  |  直到 15 年前
        1
  •  1
  •   Alex Martelli    15 年前

    复合查询使用逗号:

    dojo.query("input[type=text], textarea", ...