JavaScript Reference/Javascript Methods/execScript

Материал из Web эксперт
Перейти к: навигация, поиск

"execScript()" Example

    
<html>
<body>
<script language="JavaScript">
function function1() {
    var m = window.execScript("alert("test");", "JavaScript");
    alert("The method returns always "+"""+m+"""); 
} 
</script>
<input type="button" value="Click to execute the script" onclick="function1();">
</body>
</html>



"execScript()" is applied to

+----------------+--------------------------------------------------------------+
| Applied_To     |window                                                        |
+----------------+--------------------------------------------------------------+



"execScript()" Syntax, Parameters and Note

Note:
Executes a script. Always returns undefined.
    
Syntax:
    
window.execScript(param1, param2)

Parameters:
    param1   Required; the code to execute.
    param2   Required; the code"s script language.