Tails
02-15-2003, 06:35 PM
I'm trying to make an online of those "choose your own path" storybooks where you make decisions and go to the page it says.
I can do this in DOS batch files, but I'm having problems with JavaScript.
<body>
<form>
<script>
W=document.write
W('<input type="button" name="p1" value="goto Page 1" onCLick="pa1()" />')
function pa1()
{
W('<input type="button" value="goto Page 2" onClick="pa2()" />')
}
function pa2()
{
W('testing page 2')
}
</script>
</form>
</body>
The form elements don't exist after the nesting. Why? And then the error details say that the problem is at line 1 character 1. I've tried labeling names, alerting them to test, and everything. It just doesn't work. What do I do?
I can do this in DOS batch files, but I'm having problems with JavaScript.
<body>
<form>
<script>
W=document.write
W('<input type="button" name="p1" value="goto Page 1" onCLick="pa1()" />')
function pa1()
{
W('<input type="button" value="goto Page 2" onClick="pa2()" />')
}
function pa2()
{
W('testing page 2')
}
</script>
</form>
</body>
The form elements don't exist after the nesting. Why? And then the error details say that the problem is at line 1 character 1. I've tried labeling names, alerting them to test, and everything. It just doesn't work. What do I do?