View Full Version : using eval()

01-28-2004, 11:10 PM
ive made a funny program using eval()...
it will let the person(on the page) to write javascript and have it compile(if thats the right word for it)!
its quite cool, i dont know how handy it might be, but here it is none the less...

<script language="JavaScript">

function submitCode(){
var the_code = window.document.form_1.textarea_1.value;
var run_the_code=eval(the_code);

<h1>write some code!</h1>
<form name="form_1">
<textarea name="textarea_1" rows=10 cols=40>
<form onSubmit="return false;">
<input type="submit" value="submit your code" onClick="submitCode();">

very simple stuff, but for those of you who are unfamilir with eval, its pretty cool, huh?

01-29-2004, 06:43 AM
But have you searched this forum regarding the bad effect of eval? This topic is discussed intensively here (http://www.codingforums.com/showthread.php?s=&threadid=20143).

01-29-2004, 10:30 AM
Thanks for the submission, though due to what glenngv said and just the overall limited usefulness of this script, I'll be deleting this thread shortly.


01-29-2004, 10:29 PM
i would say that this is actually one of the few good uses of eval. i personally, have found exactly this set up to be amazingly helpful in the development stages of code, as i noted here: