Click to See Complete Forum and Search --> : Assing what's written (using document.write) to a variable


Tykhon
04-21-2003, 10:39 AM
I made a little file with just a document.write("number 1"). Then I made a html file with a link to that file
<script language="javascript" src="file"></script>
Now in the HTML file I want to assing what is written (number 1) to a variable without changing anything to the document.write("number 1")

AdamBrill
04-21-2003, 12:17 PM
Well... You could write it into a div and then use javascript to read it out of the div. So it would be something like this:

<div id="data"><script language="javascript" src="file"></script></div>

then you can read it like this:

theVariable = document.getElementById('data').innerText;

I hope that helps!