Graeme Hackston
04-01-2003, 12:56 AM
Is this nuts ? :eek:
Also, is there a better way to turn a string into code?
<html>
<head>
<title></title>
<script>
function f1() {
JS_div = document.getElementById('JS')
code = JS_div.innerHTML
time1 = setTimeout(code, 1)
}
function f2() {
JS_div.innerHTML = "clearTimeout(time2);alert(somevar)"
code = JS_div.innerHTML
time2 = setTimeout(code, 1)
}
</script>
</head>
<body>
<input type="button" value="go" onclick="f1()">
<div id="JS" style="display: none;">
clearTimeout(time1);
JS_div.style.display='block';
alert('here');
somevar = 'changed';
f2()
</div>
</body>
</html>
Also, is there a better way to turn a string into code?
<html>
<head>
<title></title>
<script>
function f1() {
JS_div = document.getElementById('JS')
code = JS_div.innerHTML
time1 = setTimeout(code, 1)
}
function f2() {
JS_div.innerHTML = "clearTimeout(time2);alert(somevar)"
code = JS_div.innerHTML
time2 = setTimeout(code, 1)
}
</script>
</head>
<body>
<input type="button" value="go" onclick="f1()">
<div id="JS" style="display: none;">
clearTimeout(time1);
JS_div.style.display='block';
alert('here');
somevar = 'changed';
f2()
</div>
</body>
</html>