# Dreamweaver Commands Question

**URL:** <https://forum.kirupa.com/t/dreamweaver-commands-question/198827>\
**Category:** web dev\
**Created:** [August 28, 2006, 11:29pm UTC](https://forum.kirupa.com/t/dreamweaver-commands-question/198827 "2006-08-28T23:29:05Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rhombusleech](https://avatars.discourse-cdn.com/v4/letter/r/a6a055/32.png) [@rhombusleech](https://forum.kirupa.com/u/rhombusleech)\
**Post date:** [August 28, 2006, 11:29pm UTC](https://forum.kirupa.com/t/dreamweaver-commands-question/198827/1 "2006-08-28T23:29:05Z")

</div>

Does anyone know how to write a command that will write a portion of code to an html document?

I have a command written that will create x number of html pages from a ‘template’. It basically just copys and pastes the ‘template’ file using a dynamic name generated from a for loop.

What I would like it to do, is then take the same variable it uses to generate the name, and write a section of code in the \<head\> that looks like this, where ‘z’ is the dynamic variable generated from the loop:

```auto
<script type"text/javascript">
var lesson = 'z'
</script>

```

it seems like i can only find scripting that will allow me to create actual content in the body, i.e.:

```auto
dw.getDocumentDOM().insertText('xxx');

```

anyway to get it to write code?

thanks.  
David
