admin管理员组文章数量:1317909
I already tested with 2 inputText, It runs well for example
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:inputText
tdate.onchange = function(){
tdt.value = tdate.value;
};
How can I change the value of " tdt " - h:outputText?
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:outputText
I already tested with 2 inputText, It runs well for example
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:inputText
tdate.onchange = function(){
tdt.value = tdate.value;
};
How can I change the value of " tdt " - h:outputText?
var tdate = document.getElementById('txtDate'); //h:inputText
var tdt = document.getElementById('txtDateTime'); //h:outputText
Share
Improve this question
edited Jun 1, 2012 at 4:35
BalusC
1.1m376 gold badges3.6k silver badges3.6k bronze badges
asked Jun 1, 2012 at 4:18
PeterPeter
1552 gold badges2 silver badges8 bronze badges
3
- 1 this link can be useful stackoverflow./questions/5654269/jsf-dynamically-change-form – Amit Commented Jun 1, 2012 at 4:25
- Its the same way. Its not working for output text? – sgowd Commented Jun 1, 2012 at 4:26
- yes, not working for output text – Peter Commented Jun 1, 2012 at 4:33
1 Answer
Reset to default 3Look in the generated HTML source. Rightclick page in browser and view source. You'll see that the <h:outputText>
renders a HTML <span>
element with the value in its body. To alter the body of a <span>
in JavaScript you need to manipulate the innerHTML
.
tdt.innerHTML = "new value";
本文标签: jsfHow to change houtputText value by JavaScriptStack Overflow
版权声明:本文标题:jsf - How to change h:outputText value by JavaScript? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742028454a2415992.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论