This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Dreamweaver > February 2004 > Error 1013: expected label for break
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Error 1013: expected label for break
|
|
| putts 2004-02-27, 11:30 am |
| When I go to do the debug window option to test one of my pages I get this
error....
Error 1013 expected label for break
The break statement can optionally be followed by a label that allows it to
break out of an outer loop or block statement. If the break is not inside a
loop, then it must have a label. The label must be on the same line or else
Javascript will assume it is part of the next statement following the break
statement.
Now, my switch statement looks like this....
switch (document.getElementById(fieldName_IN).className)
{
case fixClass:
case goodClass:
document.getElementById(fieldName_IN).className = fixClass
break
case fixoldClass:
case goodoldClass:
document.getElementById(fieldName_IN).className = fixoldClass
break
default:
}
This error is only supposed to happen when you have a break statement outside
of a switch or for loop. So why am I getting it here?
P.S. The default statement is blank because I had just added it while trying
to solve this issue.
| |
| Mick White 2004-02-27, 12:29 pm |
| This is not an error, you do not need a label in a switch construction.
Mick
putts wrote:
> When I go to do the debug window option to test one of my pages I get this
> error....
>
> Error 1013 expected label for break
> The break statement can optionally be followed by a label that allows it to
> break out of an outer loop or block statement. If the break is not inside a
> loop, then it must have a label. The label must be on the same line or else
> Javascript will assume it is part of the next statement following the break
> statement.
>
> Now, my switch statement looks like this....
> switch (document.getElementById(fieldName_IN).className)
> {
> case fixClass:
> case goodClass:
> document.getElementById(fieldName_IN).className = fixClass
> break
> case fixoldClass:
> case goodoldClass:
> document.getElementById(fieldName_IN).className = fixoldClass
> break
> default:
> }
>
> This error is only supposed to happen when you have a break statement outside
> of a switch or for loop. So why am I getting it here?
>
> P.S. The default statement is blank because I had just added it while trying
> to solve this issue.
>
| |
|
|
| Randy Edmunds 2004-02-27, 2:29 pm |
| Try adding a break after "default:" label (or removing it).
Also, try putting ; after each statement. There are a couple cases where
these are required (but I can't remember what they are...) so I always
put them in and it helps the parser interpret your code faster.
Randy
| |
|
| Randy, that's what I had originally. Looked up an example of a switch
statement in the Oreilly reference and it didn't have any, so I took it out.
Also, that example didn't have a break with the default. For the heck of it, I
tried it out and still got the same error message.
Mick, I'm quite sure that it's not an error also.
But, then, how do I get my debugger to work through Dreamweaver, if it keeps
stopping at this point and not letting me past.?
thanks
| |
| Randy Edmunds 2004-02-27, 7:28 pm |
| Where is "fixClass", "goodClass", etc. defined? I think you must use
constants for these values (i.e. no variables). Try using the actual
numbers instead.
HTH,
Randy
| |
| Mick White 2004-02-27, 10:28 pm |
| It's a bug in the debugger...
Mick
putts wrote:
> Randy, that's what I had originally. Looked up an example of a switch
> statement in the Oreilly reference and it didn't have any, so I took it out.
> Also, that example didn't have a break with the default. For the heck of it, I
> tried it out and still got the same error message.
>
> Mick, I'm quite sure that it's not an error also.
> But, then, how do I get my debugger to work through Dreamweaver, if it keeps
> stopping at this point and not letting me past.?
>
> thanks
>
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|