Javascript inline output

Viewed 54165

In javascript suppose you have this piece of code:

<div>
    <script type="text/javascript">var output = 'abcdefg';</script>
</div>

Is there any way to simply "echo" (using PHP terminology) the contents of output into #test? That is, to output a string inline, assuming you have no standard way of traversing or selecting from the DOM?

document.write("..."); does write the contents of output, but in doing so, it replaces the entire document with the output.

The solution I'm looking for should act the same way a PHP echo would: write the output into the document inline.

7 Answers
Related