I am trying to do a "Try-it yourself" editor but without using frames. So I added 2 textareas, one for code and one to show the result. I also added a "Run" button. I wrote the following function to execute the code in the first text area and show the result in the second text area:
function RunCode() {
var Code= document.getElementById('code').value;
document.getElementById('result').innerHTML= eval(Code);
}
But all i get in the result text area is : undefined. Sorry for my stupid questions but I am really a beginner. So:
Does the eval function works only on javascript code?
Is it right to do the result part as a text area?