<!--CTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//E--><!-- Message -->

function addtext() {
var newtext = document.myform.inputtext.value;
document.myform.outputtext.value += newtext;
}


function call_eval()
{
foo=8;
var str_in=newtext = document.myform.inputtext.value;
//eval('foo+=100; foo+=0.66;');
eval(str_in);
alert("foo now is: " + foo);
}

<!-- Form - --><form accept-charset="UNKNOWN" enctype="application/x-www-form-urlencoded" method="get">

<textarea cols="100" rows="10" name="inputtext">foo+=100; foo+=0.66; </textarea>

<input checked="checked" name="placement" type="radio" value="append" /> Add to Existing Text

<input name="placement" type="radio" value="replace" /> Replace Existing Text

<input onclick="addtext();" type="button" value="Add New Text" />

<input onclick="call_eval();" type="button" value="eval it" />

<textarea cols="100" rows="10" name="outputtext"></textarea>

</form><!-- Java begin - --> <script type="text/javascript">// <![CDATA[ function addtext() { var newtext = document.myform.inputtext.value; document.myform.outputtext.value += newtext; } function call_eval() { foo = 8; var str_in = newtext = document.myform.inputtext.value; // eval('foo = foo + 8;'); eval(str_in); alert("foo now is: " + foo); } // ]]></script> <!-- Java end - -->

Last edited Oct 12, 2010 at 5:04 AM by rochant, version 4

Comments

No comments yet.