Go Back   Armenian Knowledge Base > Technical sections > Webmaster Zone > Web Development

Reply
 
Thread Tools

add Javascript code at runtime
Old 12.08.2004, 14:36   #1
Академик
 
greka's Avatar
 
Join Date: 09 2001
Location: inside myself
Posts: 5,369
Rep Power: 6
Default add Javascript code at runtime

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>
__________________
И повешенные могут качаться в неположенную сторону. /С.Е.Лец/
Reply




Реклама:
реклама
Buy text link .

All times are GMT. The time now is 17:47.
Top

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.