views:

175

answers:

1

Hi,

How can I evaluate's document.write javascript to plaintext in C#? I'm trying to evaluate this:

<script type="text/javascript">
a=2;b=3;
document.write(a+"_"+y);
</script>

to this:

2_3
A: 

There is an article about it: http://www.west-wind.com/WebLog/posts/10688.aspx

empi
How can I pick up calls to document.write with that? A script can write multiple lines, it's not just a return value.
Dmi
You may change document.write calls to string concatenation and return the result string
empi
Yes, I am trying this now and it works :)For future reference:I am splitting up the script based on document.write. At document.write lines, I replace it with a variable to assign and then JScript.Eval.JScriptEvaluate returns the last assignment. I then remove this line, add the next chunk (until next document.write) to the existing portion of the script (from which I just removed the last line) and continue.
Dmi