スタイリングの目的でインライン要素のjavascriptから印刷されたテキストを使用するのは悪い習慣ですか?もしそうなら、JavaScriptの印刷されたテキストをスタイルする適切な方法は何ですか?スタイリングの目的でインライン要素にencase javascriptを使用するのは悪い習慣ですか?
例:
<script>
function produceMessage(){
var msg= 'This should print';
return msg;
}
</script>
<span style="color:red">script>
document.write(produceMessage());
</script></span>
EDIT:Changed document.body.appendChild(document.createTextNode(produceMessage()));
D ocument.write(produceMessage());
おかげで再びクエンティン、非常に役立ちます – user784637