[英]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. 我正在开发一个小工具,并且正在使用JavaScript来更改span的innerHTML,但是经过一些操作后,我需要读取该值。 Additionally i am using pre-entered value for spans but when i try to read new data function loads pre-entered one.
另外,我正在使用跨度的预输入值,但是当我尝试读取新的数据功能时,加载了预输入的值。 Is there any solution for that?
有什么解决办法吗?
JS: 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: 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. 如果您正在使用innerHTML来写入span元素,则应该能够再次使用它来读取。 How are you trying to read until now?
您如何尝试阅读直到现在?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.