Code:
var
id = 0
_output
#define LP(str) list2params(list(str))
client
verb
say(t as text)
id++
_output = _output + {"<div id="chat[id]"><b><a class="rainbow">[src.ckey]:</b></a> [t]</div><br>"}
//src << output(_output, "browser")
//var/list/l = list("chat[id]","[_output]")
src << output(LP("chat[id]"), "browser:sel")
src << output(LP("[_output]"), "browser:edit")
/// THE SCRIPT, THIS IS IN _output before we add anything else.
<script>
var docu;
function sel(id){
docu = id;
};
function edit(v){
var d = document.getElementById(docu);
d.style.opacity = 0;
setTimeout(function(){d.innerHTML = v; d.style.opacity = 1;},500);
};
</script>
Problem description:
I can get the sel function to call, but edit does not alter the element im supposedly selecting. Any ideas?
Now at a guess, I suspect one possibility you may be seeing is if chat[id] is a skin element, maybe your id is including characters that will get mangled. The webclient will lowercase all IDs and it strips out most non-alphanumerics.
Of course if chat[id] is a skin element, then setting its innerHTML directly typically isn't a good idea; the element itself would just be the outer casing. Better would be something like this: