Monday, May 13, 2024
 Popular · Latest · Hot · Upcoming
60
rated 0 times [  65] [ 5]  / answers: 1 / hits: 55238  / 13 Years ago, mon, july 4, 2011, 12:00:00

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.


More From » echo

 Answers
61

Kosher code aside, yes.



document.write()


[#91372] Friday, July 1, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
kayle

Total Points: 267
Total Questions: 77
Total Answers: 99

Location: Central African Republic
Member since Mon, Aug 10, 2020
4 Years ago
;