can you give more details around what you are actually trying to achieve? This sounds like one of those problems where the solution is going to be quite different from the original approach taken.
What are you doing in your javascript function that can't be done in server side code?
If it has to be client side code then what does the output really look like?
One of your options might be to do something like....
Code:
<script>
function functionJS(value) {
//javascript code fot text manipulation
return "some changed text"
}
function reformat() {
var contentDiv = document.getElementById("content");
var hiddenValue= document.getElementById("serverText");
contentDiv.innerText = reformat(hiddenValue.value);
}
</script>
...
<body onload="reformat();">
<input type="hidden" id="serverText" value="<%variable%>">
<% variable=functionJS(text); %>
<div id"content"></div>
</body>