Hi doug,

you could do something like that:
<div id="myGlobalContainer"></div>
<script type='text/javascript'>
  var counter=1;
  //... computations here return computationsResult
  if(computationsResult){
    $('myGlobalContainer').innerHTML+='<span id="mailto_+'(counter++)
+'">'+computationsResult+'</span>';
  }
</script>

So each time the computationsResult should be print, you create a span
and increment the counter so each span have a uniq ID.
There of course other way to append the new created element, in a much
more prototype way:
    $('myGlobalContainer').insert('<span id="mailto_+'(counter++)
+'">'+computationsResult+'</span>');
or
    $('myGlobalContainer').insert(new Element('span',{id:'mailto_
+'(counter++)}).update(computationsResult));

--
david

On 4 juin, 15:44, doug <[email protected]> wrote:
> I was having trouble with using Ajax.Updater with evalScripts=true and
> a javascript block with document.write in it.
>
> What I am trying to do is, run some JS, and display the result of that
> JS inline. However, it seems to only display the results of the
> document.write, and none of the other content.
>
> Right now, I call a function that spits out a JS block that does its
> computation and writes to the page using document.write.  This
> function is called as many times as is necessary with different
> parameters and the results are put into the HTML.
>
> I'm trying to think of a way around the document.write problem.
>
> One way I can think of is something like this.
>
> The function can output:
> <span id='mailto_#'></span>
> <script type='text/javascript'>
> //... computations here
> $('mailto_1').innerHTML=computationsResult;
> </script>
>
> (where # is a counter)
>
> However I don't want to create a lot of spans with ids if I don't have
> to. Does that make sense? Is there a better way to do this?
>
> Thanks,
> -d
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to