【发布时间】:2015-02-24 07:49:30
【问题描述】:
我正在尝试使文本框显示对象属性中的值。我希望文本框显示项目的当前库存水平,例如:
在文档中:script.js
var shortsF = new Object ( );
shortsF.description = "Stone Wash Denim Shorts";
shortsF.stockLevel = 20;
shortsF.price = 25.9
我希望 index.html 上的文本框“textBox1”将 shortsF.stockLevel 显示为其默认值。例如
<input type="text" id="textBox1" readOnly="true" value=??? />
这是怎么做到的?
【问题讨论】:
-
这是按照文档中的说明完成的,例如developer.mozilla.org/en-US/docs/Web/HTML/Element/Input。通过阅读文档也可以完成许多其他事情。
标签: javascript html object textbox html-input