views:

87

answers:

2

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?

+1  A: 
text1.value=System.Gadget.Settings.readString("Date1");

span tags don't have a value property. try:

span1.innerHTML=System.Gadget.Settings.readString("Date1");
Jonathan Fingland
and how would i display that?document.writeln(span1); ?
kylex
Never mind, figured it out: <span id="span1">test</span> Thank you so much!
kylex
A: 

are you sure the <span> tag is to be inside the <script> tag?

動靜能量
quite right! I missed that. Of course, an input tag would also be invalid there.
Jonathan Fingland
that was a typo on my part...
kylex