问题:
I need to set the text within a DIV element dynamically.我需要在 DIV 元素中动态设置文本。 What is the best, browser safe approach?最好的浏览器安全方法是什么? I have prototypejs and scriptaculous available.我有prototypejs和scriptaculous可用。
<div id="panel">
<div id="field_name">TEXT GOES HERE</div>
</div>
Here's what the function will look like:下面是函数的样子:
function showPanel(fieldName) {
var fieldNameElement = document.getElementById('field_name');
//Make replacement here
}
解决方案:
参考一: https://en.stackoom.com/question/Vgn参考二: https://stackoom.com/question/Vgn