开发者

Get Value of Span Element that was changed before by JavaScript

i am developing a gadget and i am using JavaScript to change innerHTML of span, but after some operations i need to read that value. Additionally i am using pre-entered value for spans but when i try to read new开发者_Go百科 data function loads pre-entered one. Is there any solution for that?

JS:

function read_write(condition,filename){
    var fso  = new ActiveXObject('Scripting.FileSystemObject');
    var fh = fso.OpenTextFile(System.Gadget.path+'\\'+filename+'.txt',condition, true,-2);
    if (condition == 1) {
    var result = fh.ReadLine();
    return result;      
    } 
    else if (condition == 2) {
    var spn1 = document.getElementById('span1').innerHTML;
    fh.WriteLine(spn1+','+document.getElementById('span2').innerHTML);
    }
    fh.Close();
}

HTML:

<table id="sonuc">
  <tbody>
    <tr>
      <td style="width:50%" valign="top">
        <span class="result" id="span1"></span><br/>
        <span class="result" id="span2"></span>
      </td>
    </tr>
  </tbody>
</table> 


If you're using innerHTML to write to the span element, you should be able to use it again to read. How are you trying to read until now?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜