<p>I need to set the text within a DIV element dynamically. What is the best, browser safe approach? I have prototypejs and scriptaculous available.</p>

<pre><code>&lt;div id="panel"&gt;
  &lt;div id="field_name"&gt;TEXT GOES HERE&lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>Here's what the function will look like:</p>

<pre><code>function showPanel(fieldName) {
  var fieldNameElement = document.getElementById('field_name');
  //Make replacement here
}
</code></pre>

```
```
$('field_name').innerHTML = 'Your text.';
```
```
One of the nifty features of Prototype is that
```
$('field_name')
```
does the same thing as
```
document.getElementById('field_name')
```
. Use it! :-)
John Topley's answer using Prototype's
```
update
```
function is another good solution.