[Javascript] Syntax Error
Rodney Myers
rodney at aflyingstart.net
Fri May 3 08:49:04 CDT 2002
preSTRvariable = eval(document.body.innerHTML)
This use of eval is ill advised since the innerHTML is never likely to
evaluate to any object definition or variable from which eval can extract a
value, and if it did it would be meaningless.
I notice you have not yet amended the indexOf line.
Rodney
SoitPP at aol.com wrote:
> and why does this come out to a syntax error at char 1, line 13.
> You aren't allowed to assign eval()'s to variables directly?
> Btw, that last one was supposed to be char 17, line 7,
>
> the following produces syntax error char 1, line 13
>
> <html>
> <head>
> <title>Function Testing</title>
> <script language="JavaScript">
> function removeValue(string) {
> if (string.indexOf("<TEXTAREA")) {
> string = string.substring(0,indexOf("<TEXTAREA")) +
> string.substring(indexOf("</TEXTAREA>",string.length))
> return string
> }
> return string
> }
> function robot() {
> // line 13
> preSTRvariable = eval(document.body.innerHTML)
> preSTRvariable = removeValue(preSTRvariable)
> }
> </script>
> </head>
> <body>
> <form>
> <button style="background-color: #FFFFFF" onClick="robot()">Click</button>
> </form>
> </body>
> </html>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list