is valid?      

Text formatted with Texy:

var x = document.getE­lementsByTagNa­me(‘h2’); for (i=0;x && i < x.length; i++) { var odkaz = “<a href=\”#“+ x[i].id +”\“>”+ x[i].innerHTML +“
”;
document.write(od­kaz);
}

Generated HTML code:

<div><script type="text/javascript"></script></div>

<p>var x = document.getE&shy;lementsByTagNa&shy;me(‘h2’); for (i=0;x &amp;&amp; i
&lt; x.length; i++) 	{ 	var odkaz = “&lt;a href=\”#“+ x[i].id
+”\“&gt;”+ x[i].innerHTML +“<br>
”;<br>
document.write(od&shy;kaz);<br>
}</p>

<div></div>

Verze Texy: 3.2.3 (konfigurace)