0

I keep getting error when running it, but when I run it in html, it work

Error

cscript script.js

script.js(1, 1) Microsoft JScript compilation error: Syntax error

Code

<HTML>
<HEAD>
<TITLE> Animated Text</TITLE>
</HEAD>
<BODY >

<FORM NAME="f1">
<TABLE>
<TR> <TD> <INPUT NAME="ta1" TYPE="text" SIZE="20"> 
<TD> <INPUT NAME="ta2" TYPE="text" SIZE="20"> 
<TD> <INPUT NAME="ta3" TYPE="text" SIZE="20">
</TABLE></FORM>

<HR>

<FORM NAME="f2" ACTION="http://netadd.com/nam.cgi" METHOD="POST">
<CENTER>
Name <INPUT NAME="pername" TYPE="text" SIZE="20"> Name<P>
Age <INPUT NAME="perage" TYPE="text" SIZE="5"> Age<P>
Occupation <INPUT NAME="perocc" TYPE="text" SIZE="20">Occupation <P>
<INPUT TYPE="Submit" VALUE="Submit">
<INPUT TYPE="Reset" VALUE="Reset">
</CENTER>
</FORM>

<HR>
<FORM NAME="f3">
<TABLE>
<TR> <TD> <INPUT NAME="ta4" TYPE="text" SIZE="20"> 
<TD> <INPUT NAME="ta5" TYPE="text" SIZE="20"> 
<TD> <INPUT NAME="ta6" TYPE="text" SIZE="20">
</TABLE></FORM>

<SCRIPT LANGUAGE= "javascript">
setTimeout("document.f1.ta1.value = 'Answer Soon'", 1000)
setTimeout("document.f1.ta1.value = ''", 1300)
setTimeout("document.f1.ta2.value = 'Answer Soon'", 1600)
setTimeout("document.f1.ta2.value = ''", 1900)
setTimeout("document.f1.ta3.value = 'Answer Soon'", 2200)
setTimeout("document.f1.ta3.value = ''", 2500)
setTimeout("document.f3.ta4.value = 'Answer Soon'", 2800)
setTimeout("document.f3.ta4.value = ''", 3100)
setTimeout("document.f3.ta5.value = 'Answer Soon'", 3400)
setTimeout("document.f3.ta5.value = ''", 3700)
setTimeout("document.f3.ta6.value = 'Answer Soon'", 4000)
setTimeout("document.f3.ta6.value = ''", 4300)
</SCRIPT> 
</HTML>
1
  • do you need any further help with this question? Commented Mar 20, 2014 at 23:20

1 Answer 1

2

Windows Script Host (cscript.exe/wscript.exe) cannot run HTML files. They can only run files that are valid JavaScript syntax.

What you have between the <script></script> tags, for example, is syntactically valid JavaScript, but setTimeout and document do not exist in Windows Script Host because they are DOM (browser) functions.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.