How to add some Javascript code at runtime and run it?
Say, the code that should be appended is:
Code:
<script language=JAVASCRIPT>
var ttt = 'nnnn';
function tryme(){ ttt = 'ASDASD'; }
</script>
"AppendCode()" should add that javascript code.
Say, HTML code is:
Code:
<html>
<head>
<title>test document.write</title>
<script language="JavaScript">
function AppendCode()
{
text='_this part somehow should add a new function and execute it_';
document.write(test);
}
</script>
</head>
<body><form>
<input type=button value="click me" onclick="AppendCode()">
</form></body></html>