显示输入字段,捕获值

时间:2011-01-21 05:37:01

标签: javascript input this

这很有效,但很草率。有什么改进建议吗?首次单击某些字段时,值将不确定,直到再次单击它们为止。

基本上,您单击粗体文本并显示输入字段。您键入该字段并再次单击它会捕获该值并使其以粗体文本代替该字段。

function askName(x)
{
   response = " --- input class=widgetstyle onClick=_setName(this.value) size=10 type=text value=" + this.name + ">"
   characters[x].setName(response)
   if (this.name != 0)
   {
      response = this.name;
      this.name = 0;
      characters[x].setName(response)
   }
}

function _setName(x)
{
   this.name=x;
   this.refresh()
}

0 个答案:

没有答案