I’m having trouble finding a bug in my JavaScript code. It tells me a runtime error has occurred: Expected ')'
Here is the code:
<xsl:for-each select="./projects/project">
<script LANGUAGE='Javascript'>
x = 0;
if(x == 0) {
document.write("<td style="background-color:#76787A" ><xsl:value-of select="weight"/></td>")
}
else
{
document.write("<td><xsl:value-of select="weight"/></td>")
}
</script>
</xsl:for-each>
What do you think?
You are not escaping your strings properly. If you look closely, the syntax highlighting here on SO shows you the problem.
Use escaped
\"or single quotes'when using quotes inside a string.