Javascript 变量无法正确显示
我正在尝试创建一个 Vista 小工具,我已正确存储了 Date1 变量并尝试提取它:
<html>
<head>
<title>None</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
System.Gadget.settingsUI="settings.html";
System.Gadget.onSettingsClosed = settingsClosed;
function settingsClosed(p_event) {
// if OK button is clicked reload gadget
if (p_event.closeAction == p_event.Action.commit) {
// pull settings from here
text1.value=System.Gadget.Settings.readString("Date1");
}
}
</script>
</head>
<body>
<span class="stext">Last Serviced:<br />
<span id="text1">Nothing Yet</span>
</span>
</body>
</html>
使用 span 标签,text1 不显示任何内容。 但是,如果我使用输入标签:
<input id="text1" type="text" />
那么数据就会显示。 我在这里做错了什么?
I'm trying to create a Vista gadget, I've properly stored my Date1 variable and am trying to pull it:
<html>
<head>
<title>None</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script type="text/javascript">
System.Gadget.settingsUI="settings.html";
System.Gadget.onSettingsClosed = settingsClosed;
function settingsClosed(p_event) {
// if OK button is clicked reload gadget
if (p_event.closeAction == p_event.Action.commit) {
// pull settings from here
text1.value=System.Gadget.Settings.readString("Date1");
}
}
</script>
</head>
<body>
<span class="stext">Last Serviced:<br />
<span id="text1">Nothing Yet</span>
</span>
</body>
</html>
Using the span tag, text1 does not display anything.
However, if i use an input tag:
<input id="text1" type="text" />
Then the data DOES get displayed. What am I doing wrong here?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
span 标签没有 value 属性。 尝试:
span tags don't have a value property. try:
您确定吗? 标签位于
are you sure the <span> tag is to be inside the <script> tag?