Niklas Riecken
Niklas Riecken

Reputation: 299

Uncaught SyntaxError: Unexpected token }

Got something strange here. I got the error "Uncaught SyntaxError: Unexpected token } " And Chrome mentions the problem in this line:

<html>

And i do not see any problem here. My code is here:

<script type="text/javascript">
<!--
var zaehler = 0;

function plus()
{
    document.getElementById("table_dienstleistungen").innerHTML += "<table rules=\"all\" width=\"100%\" style=\"border:1px black solid; margin-bottom: 10px;\"><tr><td>Dienstleistung:</td><td align=\"right\"><input size=\"20\" name=\"textfeldname[]\" type=\"text\" onBlur=\"document.getElementById(\"dienstleistungen-" + zaehler +"\").value=this.value\"></td></tr><tr><td>Stundenlohn in /Std:</td><td align=\"right\"><input size=\"5\" name=\"stundenlohn[]\" type=\"text\"></td></tr></table>";
    document.getElementById("hidden_infos").innerHTML += "<div id=\"save-" + zaehler + "\"><table rules=\"all\" width=\"100%\" style=\"border:1px black solid; margin-bottom: 10px;\"><tr><td>Dienstleistung:</td><td align=\"right\"><input id =\"dienstleistungen-" + zaehler + "\" size=\"20\" name=\"textfeldname[]\" type=\"text\"></td></tr><tr><td>Stundenlohn in /Std:</td><td align=\"right\"><input size=\"5\" name=\"stundenlohn[]\" type=\"text\"></td></tr></table></div>";
    zaehler ++;
}

function minus()
{
    zaehler --;
    document.getElementById("table_dienstleistungen").innerHTML = "";
    document.getElementById("save-"+zaehler).innerHTML = "";
    for(var zahl=0; zahl <= zaehler; zahl++){
        document.getElementById("table_dienstleistungen").innerHTML += document.getElementById("save-"+zahl).innerHTML;
    }
}
//-->
</script>

This code is Included in my main page via "Include" from a seperate HTML Document.

Upvotes: 0

Views: 7603

Answers (1)

BrunoLM
BrunoLM

Reputation: 100331

This is invalid Javascript

<!--

This is simply a comment

//-->

Probably removing the first line will solve your issue.

Upvotes: 1

Related Questions