<script>
var aa=66;
var d="aa";
alert(eval(d));
</script>

解决方案 »

  1.   

    就是eval
    关于eval
    Function:  eval --------------------------------------------------------------------------------
    eval(codestring) 
     
    The top-level function, eval, evaluates and/or executes a string of JavaScript code that is contained in the codestring argument. 
     
    First, eval determines if the argument is a valid string and then parses the string looking for JavaScript code. If there are JavaScript statements in the code, they will be executed and eval will return the value of the last statement (if there is a value). If there is a JavaScript expression, it will be evaluated and its value will be returned. 
     
    Note that the codestring argument is optional. However, if there is no argument, eval returned, "undefined". 
     
    Code: 
    eval("fred=999; wilma=777; document.write(fred + wilma);"); 
     
    Output: 
    1776 关于日期的常见操作
    http://community.csdn.net//Expert/TopicView2.asp?id=4360247&datebasetype=now
    js FAQ贴
    http://community.csdn.net//Expert/TopicView2.asp?id=4356360&datebasetype=now
    DHTML手册,js手册,dom手册下载
    http://community.csdn.net//Expert/TopicView2.asp?id=4356325&datebasetype=now