ChrisB: JS Variable bei onclick

Beitrag lesen

Hi,

Das heißt eigentlich müsste ich das so machen:
_div.innerHTML += "<div style='border:1px solid;'><a onclick = function(value) {return function() {alert(value);}}>" + variabler_text + "</a></div>";

Wenn schon, müsstest du es erst mal syntaktisch korrekt machen.

Leider funktioniert es so nicht

Welchen Inhalt soll das onclick-Attribut des A-Elements haben?

MfG ChrisB

--
Light travels faster than sound - that's why most people appear bright until you hear them speak.